|
-
Jan 30th, 2003, 05:04 AM
#1
Thread Starter
New Member
Add DataRow to MS Access database
Very green to this so bear with me, this is my code and when executing the Public Sub executes with no errors util it hits the last line of code "objDA_bdg_Accnt.Update(objDS_bdg_Accnt)".
I get the following exception "Update unable to find TableMapping['Table'] or DataTable 'Table'."
-----------------------------------------------------------------------------------
Public Sub Add_bdg_Accnt()
Dim objRow As DataRow
If txtActNum.Text = "" Then Exit Sub
objRow = objDS_bdg_Accnt.Tables("bdg_Accnt").NewRow()
objRow.Item("Act_Name") = txtActName.Text
objRow.Item("Act_Num") = txtActNum.Text
objRow.Item("Act_Owner") = txtActOwner.Text
objDS_bdg_Accnt.Tables("bdg_Accnt").Rows.Add(objRow)
objDA_bdg_Accnt.Update(objDS_bdg_Accnt)
End Sub
-----------------------------------------------------------------------------------
As an extra note I'm writing this code more or less out of a book and according to the book this should be it.
And if somebody feels up to it, could you explain what exactly happens as the code is executed. From what I gather the DataSet is populated and then can be updated and works as a temporary table. And not until the last line is run the actual DB is suppose to be updated.
I have successfully managed to pull a record from the DB and update it, but I just can't seem to add a new row. Also one last thing the table has 6 columns:
Act_Id = AutoNumber (Primary Key)
Bnk_Id = Number (Not Required)
Act_Name = Text (Required)
Act_Num = Text (Required)
Act_Owner = Text (Required)
Act_Value = Number (Not Required)
Thanx for listening
Claudio
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
|