|
-
Jun 4th, 2002, 08:24 PM
#1
Thread Starter
Junior Member
Insert Command and Update database
The following sub is used to store in the dataset a new record/row.
With dssupport.Tables("Supportcall")
NewRow = .NewRow()
NewRow("ID") = Me.txtcallnumber.Text
NewRow("Description")=Me.txtcalldescription.Text
.Rows.Add(NewRow)
End With
However when I come to hit the update the database with
dbsupport.Update(dssupport, "Supportcall")
I am bombed out with a insertcommand error.
How and where do I configure this?
-
Jun 4th, 2002, 09:24 PM
#2
Addicted Member
You might be able to configure it in the DataAdapter Configuration Wizard.
You could also declare command objects in code, and have them update the database.
Did you use the IDE controls and drag them on the form, or did you declare all the objects in code?
That which does not kill us, only makes us stronger. 
-
Jun 4th, 2002, 11:48 PM
#3
Thread Starter
Junior Member
I declared them in code
Dim dbsupport As New OleDbDataAdapter()
Dim dssupport As New DataSet()
Dim saved As Boolean
Dim dbconn As OleDbConnection = New OleDbConnection("Provider=Microsoft.jet.oledb.4.0;" & "Data Source =P:\Support Calls\mosaic.mdb")
Dim cmdsupport As New OleDbCommand()
with
cmdsupport = dbconn.CreateCommand
cmdsupport.CommandText = "select * from Supportcall"
dbsupport.SelectCommand = cmdsupport
dbsupport.Fill(dssupport, "SupportCall")
declared in the form load
-
Jun 5th, 2002, 03:02 AM
#4
It looks like you didn't create an insert command at all. In order to insert a record, the dataadapter needs an insert command (and for updates and deletes an update and a delete command as well).
Have a look at this tutorial: Using ADO.NET
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|