Hi,
You can not bind a window form grid to a datareader. that is only
available for the webform based one. Use a dataset instead.
Dim strConn As String
Dim strSQL As String
Dim da As OleDbDataAdapter
Dim conn As OleDbConnection
strConn = "Provider = Microsoft.Jet.OLEDB.4.0;"
strConn &= "Data Source = Northwind.mdb;"
conn = New OleDbConnection(strConn)
da = New OleDbDataAdapter("Select * From Categories", conn)
da.Fill(ds, "Categories")
DataGrid1.DataSource = ds .Tables("Categories")
Ken
--------------
"Lou" <lo********@comcast.net> wrote in message
news:37********************@comcast.com...
I can't get it to work?
Why doesn't my grid populate
Dim conn As New OleDbConnection
Dim myData As OleDbDataReader
Dim cmd As New OleDbCommand
Dim connString As String
Dim i As Integer
Try
' Set the connection string.
connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= D:\Lou
Projects\Projects.mdb"
' Open the connection.
conn.ConnectionString = connString
conn.Open()
'Set the command properties.
cmd.Connection = conn
cmd.CommandText = "SELECT * from client"
myData = _
cmd.ExecuteReader(CommandBehavior.CloseConnection)
Try
While (myData.Read)
'Process data.
DataGrid1.DataSource = myData
End While
Finally
myData.Close()
End Try
Catch ex As Exception
'Error handling
Debug.Write(Err.Description)
End Try
End Function 'GetAccessData
"scorpion53061" <ad***@nospamherekjmsolutions.com> wrote in message
news:e6**************@TK2MSFTNGP09.phx.gbl...
Don't be scared. Plenty of MS samples use Access
http://www.connectionstrings.com/
http://support.microsoft.com/kb/821765/EN-US/
"Lou" <lo********@comcast.net> wrote in message
news:r_********************@comcast.com: Where can I find sample code to connect/use an Access DB, all the
microsoft
samples require SQL and I don't have that. This will be my first .Net
app!
Scared...