DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Threaded View

  1. #1
    Join Date
    Feb 2009

    Wink How to get values from VFP DB each row n column in VB.NET

    How to get values from VFP DB each row n column in VB.NET

    I am trying and eager to et in to .NET and I have few issues trying to get a program which created to make it work.
    I have a table ex:
    Table user
    Name account TotValue

    John 1234 120.00
    Doe 3423 1129.00
    Axel 6554 2670.00
    Mia 6543 200.00

    I have created a program where when it runs it should read each of the rows TotValue and put them in a special band

    Band 1 = 0 to 200
    Band 2 = 1000 to 2000
    Band 3 = 2000 to 5000

    When run the program it should go through each row and see if the TotValue belongs to any of the given bands and if that’s the case it should count how many should fit in to the given bands criteria.
    In this case
    Band 1 = 0 to 200 = 2
    Band 2 = 1000 to 2000 = 1
    Band 3 = 2000 to 5000 = 1

    This is by codes and I have issues getting it go through each row, on VB6 I used BOF and EOF, but in VB.NET I am not sure how to get this work.
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim conn As Odbc.OdbcConnection
            Dim comm As Odbc.OdbcCommand
            Dim dr As Odbc.OdbcDataReader
            Dim connectionString As String
            Dim sql As String
            Dim ADTotalN1Con1 As Decimal
            Cursor.Current = Cursors.WaitCursor
            ToolStripStatusLabel1.Text = "Calculating ..."
            'Open connection to the ODBC DSN
            connectionString = "DSN=total_value"
            sql = "SELECT TotValue from user "
            conn = New Odbc.OdbcConnection(connectionString)
            comm = New Odbc.OdbcCommand(sql, conn)
            dr = comm.ExecuteReader()
            'go through each row of the table and check if the TotValue fit in to any of the bands
            'if so calculate how many of them (n amount) would fit in to each band
    I need help here to go through each row and get the value 
    		If TotValue > 0 and TotValue < 200 then 
    			b1=b1 +1 
    		Elseif TotValue > 1000 and TotValue < 2000 then
    		ElseifTotValue > 2000 and TotValue < 5000 then
    		End if
            'Close connection
        End Sub
    Any help to get this sorted will be very much appreciated.

    Last edited by Hack; 02-27-2009 at 11:35 AM. Reason: Added Code Tags

Similar Threads

  1. Previous & Next Record
    By nickiii in forum .NET
    Replies: 2
    Last Post: 07-01-2005, 12:03 PM
  2. Over on the MS VB.NET group...
    By Tom Shelton in forum .NET
    Replies: 39
    Last Post: 11-08-2002, 06:23 AM
  3. Replies: 0
    Last Post: 02-11-2002, 02:10 PM
  4. row level triggers
    By Ervin Rodriguez in forum Database
    Replies: 3
    Last Post: 02-07-2002, 06:21 PM
  5. Whats the deal with Fox?
    By Joe C. in forum Talk to the Editors
    Replies: 50
    Last Post: 07-30-2000, 07:47 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center