Hi
I am very new to vb.net and still trying to get my head around it. I am trying to connect to an access db and then update a table with some test info
my code is:
eveytime i run the code i get the error 'System.NullReferenceException'
i wondered if anyone could help?
I am very new to vb.net and still trying to get my head around it. I am trying to connect to an access db and then update a table with some test info
my code is:
VB.NET:
Dim con As New OleDb.OleDbConnection
Dim sql As String
Dim ds As New DataSet
Dim da As OleDb.OleDbDataAdapter
Dim MakeTableSQL As String
Dim MySql As String
Dim MySql2 As String
Dim MySql3 As String
con.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = C:\email.mdb"
sql = "SELECT * FROM Email"
da = New OleDb.OleDbDataAdapter(sql, con)
Dim cb As New OleDb.OleDbCommandBuilder(da)
Dim dsNewRow As DataRow
dsNewRow = ds.Tables("Labels").NewRow()
dsNewRow.Item("Body") = "Test"
ds.Tables("Labels").Rows.Add(dsNewRow)
da.Update(ds, "Labels")
MsgBox("New Record added to the Database")
eveytime i run the code i get the error 'System.NullReferenceException'
i wondered if anyone could help?