By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,327 Members | 1,096 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,327 IT Pros & Developers. It's quick & easy.

OleDbDataAdapter.Update MSAccess Table

P: n/a
Don

Using: VS 2003, Access 2002, WinXP w\No service packs

I'm trying to add a record to an Access table via an OleDbDataAdapter
while keeping a little bit of my sanity. Neither is working.

Please see below and Please help.

Don

The line:
SnipsDA.Update(SnipsDS, "snips")

produces the ERROR:

"No value given for one or more required parameters."

I've copied the exact InsertCMD into Access and it works perfectly.

Here is the actual Access Table Columns:

NodeID, Autonumber
GUID_ID, Text(36)
ParentID, Text(36)
NodeText, Text(255)
NodeType. Integer
Here's the *^%! function:

Public Function AddSnip(ByVal ParentId As String, ByVal txt As
String, ByVal nodeType As Integer) As String

Dim t As DataTable = SnipsDS.Tables("snips")
Dim newRow As DataRow = t.NewRow()

newRow("GUID_ID") = GetGuid()
newRow("ParentId") = ParentId
newRow("NodeText") = txt
newRow("NodeType") = nodeType
If Not newRow Is Nothing Then
t.Rows.Add(newRow)
End If

snipConn = ConnectToAccess()
If Not snipConn.State = ConnectionState.Open Then Exit
Function

InsertCMD = New OleDbCommand("INSERT INTO T_Snippet(GUID_ID,
ParentID, NodeText, NodeType) VALUES (? , ? , ? , ?)", snipConn)

SnipsDA.InsertCommand = InsertCMD

Dim RecordsUpdated As Integer
If SnipsDS.HasChanges Then
Try
RecordsUpdated = SnipsDA.Update(SnipsDS, "snips")
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
End If

Return newRow("GUID_ID")
End Function
Mar 26 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.