ADO.NET connection problems

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,
Need help with this:
I am trying to connect to an existing Access Database via ODBC.
My code is like this: It always generates a system error.
What am I doing wrong? Any help much appreciated.
-----------------------------------------------------------
'Code in VB.net
Dim conn As String = InputBox("Conn string?")
Dim sql As String = InputBox("Sql string?")
Dim dt As New DataTable

Dim co As New Odbc.OdbcConnection(conn)
co.Open()
Dim dataadapter As New _
System.Data.Odbc.OdbcDataAdapter(sql, co)
dataadapter.Fill(dt)
dataadapter.Dispose()

Me.DataGrid1.DataSource = d
 
Hi Mark,

What's and when the error happens?
Code seems ok for a test (as you shoud really don't do it that way), I guess
conn or sql value is wrong.
 
Back
Top