|
-
Apr 5th, 2005, 03:00 PM
#1
Thread Starter
New Member
Why doesn't the database update?
Ok, I'm using ASP.NET with Microsoft Access 2000, I use the OLEDataAdapter to make a dataconnection to my .mdb database using Microsoft Jet 4.0 (or something like that). I can read from the database but when I fill the database into a dataset, change the dataset, then use the update comand in the dataadaptor it doesn't come up with any errors, it just doesn't update the database. Am i doing anything wrong?
VB Code:
Dim dat As New DataSet
adapt.Fill(dat)
Dim ar(2)
ar(0) = TextBox1.Text
ar(1) = TextBox2.Text
ar(2) = TextBox3.Text
dat.Tables("Pass").NewRow().ItemArray = ar
dat.AcceptChanges()
adapt.Update(dat)
I've tried lots of different methods, I've told the connection to open and close, I've updated the database with datarows and a datatable instead of a whole dataset, so far nothing seems to ahve worked, it just won't save, I don'tknow why and i was wondering if anybody knew whether somnething had gone wrong in my code, I used a wizard to create the update, insert and delete SQl statements so maybe it is something wrong with those.
KB04
-
Apr 6th, 2005, 10:18 PM
#2
Frenzied Member
Re: Why doesn't the database update?
 Originally Posted by KB04
Ok, I'm using ASP.NET with Microsoft Access 2000, I use the OLEDataAdapter to make a dataconnection to my .mdb database using Microsoft Jet 4.0 (or something like that). I can read from the database but when I fill the database into a dataset, change the dataset, then use the update comand in the dataadaptor it doesn't come up with any errors, it just doesn't update the database. Am i doing anything wrong?
VB Code:
Dim dat As New DataSet
adapt.Fill(dat)
Dim ar(2)
ar(0) = TextBox1.Text
ar(1) = TextBox2.Text
ar(2) = TextBox3.Text
dat.Tables("Pass").NewRow().ItemArray = ar
dat.AcceptChanges()
adapt.Update(dat)
I've tried lots of different methods, I've told the connection to open and close, I've updated the database with datarows and a datatable instead of a whole dataset, so far nothing seems to ahve worked, it just won't save, I don'tknow why and i was wondering if anybody knew whether somnething had gone wrong in my code, I used a wizard to create the update, insert and delete SQl statements so maybe it is something wrong with those.
KB04 
I think you have the last two lines backwards. Try:
VB Code:
adapt.Update(dat)
dat.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
|