How do I do this VB6 ADO code in ADO .NET

  • Thread starter Thread starter Mark Worsnop
  • Start date Start date
M

Mark Worsnop

Below is a short simple ADO in VB6. I have been messing with this most of
the day trying to do the same thing in VB .NET ADO.NET. Can anyone give me a
clue where to look next?

I think I got the connection figured out, but I usually connect once at the
beginning of the program globally, but this seems to only let me declare the
Connection in the class I am in. Sorry for all the dumb questions, still
learning.

THANK YOU!

BaseConnStr = "Provider=MSDataShape.1;Persist Security Info=True;Data
Provider=SQLOLEDB.1;Trusted_Connection=yes ;Data Source=xx;User
ID=xx;Password=xx;Initial Catalog=xx"


CN.Open BaseConnStr

RS.Open "Select top 10 name from customer ", CN, adOpenStatic, adLockReadOnly

While Not RS.EOF

Text1.Text = Text1.Text & RS.Fields("name").Value & vbCrLf

RS.MoveNext

Wend

RS.Close
Set RS = Nothing
 
I got the book by William R. Vaughn
ADO and ADO.NET Examples and Best Practices for VB Developers.

Williams recommended his book in another post, and I have been up all night
reading it. GREAT BOOK. For all you newbies (like me) it sure has helped!
 
Back
Top