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