Results 1 to 3 of 3

Thread: convert this simple vb6 app to vb.net?

Threaded View

  1. #1

    Thread Starter
    New Member callisto's Avatar
    Join Date
    Mar 2003
    Posts
    14

    convert this simple vb6 app to vb.net?

    VB Code:
    1. Option Explicit
    2. Dim cn As New ADODB.Connection  
    3. Dim rs As New ADODB.Recordset    
    4. Private Sub cmdConnect_Click()    
    5.     cn.ConnectionString = "DRIVER={SQL SERVER};SERVER=192.168.0.1;DATABASE=dev_test;UID=sa;PWD=password;"    
    6.     cn.Open    
    7.      rs.Open "Select * from Brokerdb", cn, adOpenStatic, adLockOptimistic  
    8. End Sub    
    9.  
    10. Private Sub cmdMoveNext_Click()    
    11.    If (Not rs.EOF) Then        
    12.      Text1.Text = rs.Fields(0)      
    13.      Text2.Text = rs.Fields(1)        
    14.      rs.MoveNext    
    15.    End If  
    16. End Sub  
    17.  
    18. Private Sub cmdMovePrevious_Click()    
    19.   If (Not rs.BOF) Then        
    20.    Text1.Text = rs.Fields(0)      
    21.    Text2.Text = rs.Fields(1)        
    22.    rs.MovePrevious    
    23.   End If  
    24.  
    25. End Sub

    I'm trying to move to .Net. Have trouble with gettting certain fields out of the the data returned from the database.
    Example: Select * from BrokerDB returns the following fields - BrokerName, BrokerCode, BrokerLocation.
    How do I get the 3rd row, BrokerName and BrokerLocation into 2 textboxes?
    Or add rows 2 through 10, Fields BrokerName and BrokerLocation into 2 Listboxes (one for BrokerLocation) and other for BrokerName)?
    I've 3 yrs VB6 experience, 3 day .NET.
    Last edited by callisto; May 11th, 2004 at 04:01 AM.
    If life throws you a curve,
    code a parabole.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width