|
-
Jun 9th, 2002, 05:29 PM
#1
Thread Starter
Junior Member
Saving a new row to the database
The following prodedure should save a new row to the database.
I can't see what the error is, but when I create the command builder, the complier does not like dbsupport.
What have I done wrong
Dim NewRow As System.Data.DataRow
Dim dsadapter As OleDbDataAdapter
Dim dr As DataRow
dr = dssupport.Tables("Supportcall").NewRow()
dr("ID") = txtcallnumber.Text
dr("Customer") = cmbcustomer.Text
dr("Description") = txtcalldescription
dr("Contact") = txtcallcontact.Text
'Get connection string
strconn = "Provider=Microsoft.jet.oledb.4.0;" & "Data Source =P:\Support Calls\mosaic.mdb"
'Build SQL string
insertsql = "INSERT INTO Supportcall(ID, Customer, Description, Contact)" & " VALUES(?,?,?,?)"
'Create new data adpater
dbsupport = New OleDbDataAdapter(insertSQL, strconn)
'Create command builder for adapter
cmbbuild = New OleDbDataAdapter(dbsupport)
'Get Insert command object
dbsupport.InsertCommand = cmbbuild.GetInsertCommand()
'Submit insert statement through adpater
dbsupport.Update(dssupport, "Supportcall")
'Tell data set changes are complete
dssupport.AcceptChanges()
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
|