|
-
Sep 9th, 2002, 09:00 PM
#1
Thread Starter
Junior Member
Working with an Access DB
In my database, I have a list of employees, and some info about them (address, social sec no, etc). I made a form in vb.net opening the db, reading the records into a dataset, then i dim a datarow, and push the selected employee's values into the row, and finally display them on the form.
These are my dims: (all in the declarations section)
Code:
Dim objConnection As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & clientdb)
Dim objPayeeDA As New OleDb.OleDbDataAdapter("Select * from Payees", objConnection)
Dim objPayeeCA As New OleDb.OleDbCommandBuilder(objPayeeDA)
Dim objDataSet As New DataSet()
I sucessfully open the the table, and show all the values to txtboxes. Next, the user changes whatever values that are nescessary, and they click the "save" button. This is the code behind it:
Code:
Dim objRow As DataRow, idno As Int32
idno = cboID.SelectedIndex
objRow = objDataSet.Tables("Payees").Rows(idno)
objDataSet.Tables("Payees").Rows(idno).Item("ID") = strID
objRow.Item("LastName") = txtLastName.Text
objRow.Item("FirstName") = txtFirstName.Text
objRow.Item("Address") = txtAddress.Text
objRow.Item("CitySTZip") = txtCitySTZip.Text
objRow.Item("SocialSec") = txtSocialSec.Text
objRow.Item("State") = txtState.Text
objRow.Item("Locality") = txtLocality.Text
objRow.Item("Type") = txtType.Text
objRow.Item("Retirement") = chkRetirement.Checked
objRow.Item("LegalRep") = chkLegalRep.Checked
objRow.Item("HshldPayee") = chkHshldPayee.Checked
objRow.Item("3rdPrtySickPay") = chk3rdPrtySickPay.Checked
objRow.Item("StatutoryEmployee") = chkStatutoryEmployee.Checked
objRow.Item("DeferredComp") = chkDeferredComp.Checked
objRow.Item("ShowSSinFedID") = chkShowSSinFedID.Checked
objRow.Item("SubjectToSUI") = chkSubjectToSUI.Checked
objPayeeDA.Update(objDataSet, "Payees")
End Sub
The code errors on the last line! Basically, after I update the datarow, i wanna update the dataset, and save it with the DataAdapter. What am I missing?
By the way, if Karl Moore actually looks at this forum, I would like to thank him for writing such an amazing book. I recomend it anyone who knows a little vb6, and wants to get into the .net world!
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
|