Adding a record

KingAce

Member
Joined
Jun 26, 2005
Messages
7
This code doesnt seem to be working for adding a new record:

Dim newcourse As Data.DataRow
newcourse = NewCourse1.Tables(0).NewRow
newcourse.Item("Name") = TextBox1.Text
NewCourse1.Tables(0).Rows.Add(newcourse)
NewCourse1.AcceptChanges()
OleDbDataAdapter1.Update(NewCourse1, "Course")
Why not?
TIA
 
KingAce said:
This code doesnt seem to be working for adding a new record:

Dim newcourse As Data.DataRow
newcourse = NewCourse1.Tables(0).NewRow
newcourse.Item("Name") = TextBox1.Text
NewCourse1.Tables(0).Rows.Add(newcourse)
NewCourse1.AcceptChanges()
OleDbDataAdapter1.Update(NewCourse1, "Course")
Why not?
TIA


Because you called AcceptChanges(). Update will call it for you after it calls the appropriate Insert command internally.
 
bri189a said:
Because you called AcceptChanges(). Update will call it for you after it calls the appropriate Insert command internally.

i feel like such an idiot. thanks alot
 
Back
Top