C
CES
All,
I've spent all day trying to find simple examples of how ADO.NET works but
I'm still out of luck. I'm trying to do one simple thing add a new row to an
Access Database. I've adapted the code below from a number of sources but
I'm getting an error on the last line "daVisitors.Update(drVisitors)". The
Compiler Error Message: BC30518: Overload resolution failed because no
accessible 'Update' can be called with these arguments. Because I don't have
a clue what I'm doing I can't see what's causing the error. The page that I
found most of this code on said it should work???
Dim cnObj as OleDbConnection = New
OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & dbPath &
";")
Dim daVisitors As OleDbDataAdapter = New OleDbDataAdapter("SELECT * From
Visitors", cnObj)
Dim dsVisitors As New DataSet()
Dim dtVisitors As DataTable
Dim drVisitors As DataRow
cnObj.Open()
daVisitors.Fill(dsVisitors, "Visitors")
dtVisitors = dsVisitors.Tables("Visitors")
drVisitors = dtVisitors.NewRow()
With drVisitors
.Item("Field1") = "Data 1"
.Item("Field2") = "Data 2"
End With
dtVisitors.Rows.Add(drVisitors)
daVisitors.Update(drVisitors)
cnObj.Close
How the hell did any of you learn this crap!!! I had an adequate knowledge
of ADO 2.5 within an hour and have had vary little problem picking up the
vb.net syntax but this makes me feel like I'm speaking a new language. Any
help and direction would be greatly appreciated.
CES
I've spent all day trying to find simple examples of how ADO.NET works but
I'm still out of luck. I'm trying to do one simple thing add a new row to an
Access Database. I've adapted the code below from a number of sources but
I'm getting an error on the last line "daVisitors.Update(drVisitors)". The
Compiler Error Message: BC30518: Overload resolution failed because no
accessible 'Update' can be called with these arguments. Because I don't have
a clue what I'm doing I can't see what's causing the error. The page that I
found most of this code on said it should work???
Dim cnObj as OleDbConnection = New
OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & dbPath &
";")
Dim daVisitors As OleDbDataAdapter = New OleDbDataAdapter("SELECT * From
Visitors", cnObj)
Dim dsVisitors As New DataSet()
Dim dtVisitors As DataTable
Dim drVisitors As DataRow
cnObj.Open()
daVisitors.Fill(dsVisitors, "Visitors")
dtVisitors = dsVisitors.Tables("Visitors")
drVisitors = dtVisitors.NewRow()
With drVisitors
.Item("Field1") = "Data 1"
.Item("Field2") = "Data 2"
End With
dtVisitors.Rows.Add(drVisitors)
daVisitors.Update(drVisitors)
cnObj.Close
How the hell did any of you learn this crap!!! I had an adequate knowledge
of ADO 2.5 within an hour and have had vary little problem picking up the
vb.net syntax but this makes me feel like I'm speaking a new language. Any
help and direction would be greatly appreciated.
CES