Hey how's it going,
I'm basically yet another newb who hasn't used VB in a long time and I'm trying to get back into it for some projects I wanted to complete at home. I'm currently using VS.NET 2003 for the first time and I'm trying to learn how to connect to a mysql database I have setup. I'm pretty sure all the required files are installed to connect to a data source, I'm just not sure exactly how to connect and retrieve data. Here is what I have so far, note that when I try running this code I receive this error "An unhandled exception of type 'System.Data.Odbc.OdbcException' occurred in system.data.dll" .. I'm kinda stuck, thanks for all your help:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim connectionString As String = "Driver={MySQL};SERVER=localhost;DATABASE=bmp;"
Dim conn As New Odbc.OdbcConnection(connectionString)
conn.Open()
Dim da As New Odbc.OdbcDataAdapter("SELECT id, movie, filename, description, views FROM movie", conn)
Dim ds As New DataSet("bmp")
da.Fill(ds, "movies")
dataGrid1.DataSource = ds.DefaultViewManager
conn.Close()
End Sub
I'm basically yet another newb who hasn't used VB in a long time and I'm trying to get back into it for some projects I wanted to complete at home. I'm currently using VS.NET 2003 for the first time and I'm trying to learn how to connect to a mysql database I have setup. I'm pretty sure all the required files are installed to connect to a data source, I'm just not sure exactly how to connect and retrieve data. Here is what I have so far, note that when I try running this code I receive this error "An unhandled exception of type 'System.Data.Odbc.OdbcException' occurred in system.data.dll" .. I'm kinda stuck, thanks for all your help:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim connectionString As String = "Driver={MySQL};SERVER=localhost;DATABASE=bmp;"
Dim conn As New Odbc.OdbcConnection(connectionString)
conn.Open()
Dim da As New Odbc.OdbcDataAdapter("SELECT id, movie, filename, description, views FROM movie", conn)
Dim ds As New DataSet("bmp")
da.Fill(ds, "movies")
dataGrid1.DataSource = ds.DefaultViewManager
conn.Close()
End Sub