Updating a Dataset

Hiya all,

Hopefully someone can help.

I have a oledb connection, adapters and a specific dataset that is pulling out specific rows of data from an Access Databse.

One of the columns in the data is a tick box, and basically I want some code that will update the tick box to false, i.e., turn the tick box off.

I already have a dataset that pulls out all records that have this tick box set to true, now I need the next step. Can anyone help? Do I use an oledb reader?

Any help would be really handy, thanks.


Pete
Software Developer

Comments

  • : Hiya all,
    :
    : Hopefully someone can help.
    :
    : I have a oledb connection, adapters and a specific dataset that is pulling out specific rows of data from an Access Databse.
    :
    : One of the columns in the data is a tick box, and basically I want some code that will update the tick box to false, i.e., turn the tick box off.
    :
    : I already have a dataset that pulls out all records that have this tick box set to true, now I need the next step. Can anyone help? Do I use an oledb reader?
    :
    : Any help would be really handy, thanks.
    :
    :
    : Pete
    : Software Developer
    :
    :

    Hi... That field will probably be a boolean. I am not sure if you want to set it to zero or -1 (anything that only takes two tries to get right I always forget :( ) You could Loop through the dataset like this...

    for each x in dataset.tables(0).rows
    : x.item("columnName") = 0
    next

    or even cleaner than that you could use a SQL update query...

    update tableXYZ
    set field = 0
    where whatever = whatever

    -Ray

  • Yeah, it is a boolean, so hadnt thought about 1's and 0's.

    Will try the loop statement out also.

    Can I not simply write a sql query and execute it against a whole dataset?

    e.g.

    "UPDATE Customers SET MEETINGSELECT = False WHERE People_PIN = 123456"

    The 'People_PIN' value is the only thing that changes through each record in the reader.

    What I had done at the minute is create this reader and populate the dataset with specific records. This works. The update command that would work afterwards also works:

    If MeetingsTicks1.HasChanges(DataRowState.Modified) Then
    OleDbDataAdapt_UpdateTicks.Update(MeetingsTicks1, "Customers")
    End If

    This will update the MeetingsTicks1 dataset.

    This update querry woorks fine of course in the Access DB, can I just fire it off in VB .NET like I do when I fill a dataset in a data adapter?

    Cheers agani

    Pete





    : : Hiya all,
    : :
    : : Hopefully someone can help.
    : :
    : : I have a oledb connection, adapters and a specific dataset that is pulling out specific rows of data from an Access Databse.
    : :
    : : One of the columns in the data is a tick box, and basically I want some code that will update the tick box to false, i.e., turn the tick box off.
    : :
    : : I already have a dataset that pulls out all records that have this tick box set to true, now I need the next step. Can anyone help? Do I use an oledb reader?
    : :
    : : Any help would be really handy, thanks.
    : :
    : :
    : : Pete
    : : Software Developer
    : :
    : :
    :
    : Hi... That field will probably be a boolean. I am not sure if you want to set it to zero or -1 (anything that only takes two tries to get right I always forget :( ) You could Loop through the dataset like this...
    :
    : for each x in dataset.tables(0).rows
    : : x.item("columnName") = 0
    : next
    :
    : or even cleaner than that you could use a SQL update query...
    :
    : update tableXYZ
    : set field = 0
    : where whatever = whatever
    :
    : -Ray
    :
    :

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories