PDA

Click to See Complete Forum and Search --> : How do I get data from my connection?


indydavid32
Dec 6th, 2002, 10:30 AM
Ok, I have my connection string...

Dim oOleDbConnection As OleDb.OleDbConnection
Dim sConnString As String = _
"Provider=sqloledb;" & _
"Data Source=Blah;" & _
"Initial Catalog=Blah;" & _
"User Id=Titus;" & _
"Password=Blah"
oOleDbConnection = New OleDb.OleDbConnection(sConnString)
oOleDbConnection.Open()

In VB 6, I would do this to get the data from this string...

Dim rs As New ADODB.Recordset

rs.CursorLocation = adUseClient
rs.CursorType = adOpenDynamic
rs.ActiveConnection = oOleDbConnection
rs.LockType = adLockOptimistic

rs.open "Select * from Blah Where Blah = Blah"

How would I do this very same thing in .Net?

Please be very specific because I know very little about .Net.

Thank you.

Edneeis
Dec 6th, 2002, 05:34 PM
Try the Data Access Overview tutorial at this site:
http://samples.gotdotnet.com/quickstart/winforms/

Athley
Dec 7th, 2002, 05:24 AM
Dim ds As New Dataset
Dim da as New Oledb.OledbDataadapter("SELECT * FROM .....", oOleDbConnection)
da.Fill(ds)