|
-
May 11th, 2004, 03:40 AM
#1
Thread Starter
New Member
convert this simple vb6 app to vb.net?
VB Code:
Option Explicit
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Private Sub cmdConnect_Click()
cn.ConnectionString = "DRIVER={SQL SERVER};SERVER=192.168.0.1;DATABASE=dev_test;UID=sa;PWD=password;"
cn.Open
rs.Open "Select * from Brokerdb", cn, adOpenStatic, adLockOptimistic
End Sub
Private Sub cmdMoveNext_Click()
If (Not rs.EOF) Then
Text1.Text = rs.Fields(0)
Text2.Text = rs.Fields(1)
rs.MoveNext
End If
End Sub
Private Sub cmdMovePrevious_Click()
If (Not rs.BOF) Then
Text1.Text = rs.Fields(0)
Text2.Text = rs.Fields(1)
rs.MovePrevious
End If
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.
-
May 11th, 2004, 03:47 AM
#2
Fanatic Member
Bind the textboxes to field then use bindingcontext to move the records .. or try to use dataform wizard then follow the codes .. (it uses binding context) .. good luck
Winanjaya
-
May 11th, 2004, 04:05 AM
#3
Thread Starter
New Member
Thanx Winyanya for replying.
I do not want to Bind the constituent controls at all! Want to set text/caption property to dataset field value manually. This is preparation for moving a BIG VB6 app to .Net.
I'll fight the dragon until I win!!!
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|