Results 1 to 2 of 2

Thread: Why doesn't the database update?

Hybrid View

  1. #1

    Thread Starter
    New Member KB04's Avatar
    Join Date
    Dec 2004
    Location
    In the middle of the woods, in the forest of dean in the UK
    Posts
    13

    Question 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:
    1. Dim dat As New DataSet
    2.         adapt.Fill(dat)
    3.         Dim ar(2)
    4.         ar(0) = TextBox1.Text
    5.         ar(1) = TextBox2.Text
    6.         ar(2) = TextBox3.Text
    7.         dat.Tables("Pass").NewRow().ItemArray = ar
    8.         dat.AcceptChanges()
    9.         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

  2. #2
    Frenzied Member
    Join Date
    Aug 2000
    Location
    Birmingham, AL
    Posts
    1,276

    Re: Why doesn't the database update?

    Quote 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:
    1. Dim dat As New DataSet
    2.         adapt.Fill(dat)
    3.         Dim ar(2)
    4.         ar(0) = TextBox1.Text
    5.         ar(1) = TextBox2.Text
    6.         ar(2) = TextBox3.Text
    7.         dat.Tables("Pass").NewRow().ItemArray = ar
    8.         dat.AcceptChanges()
    9.         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:
    1. adapt.Update(dat)
    2. 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
  •  



Click Here to Expand Forum to Full Width