Results 1 to 7 of 7

Thread: Modifying rows [still problems :-( ]

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2004
    Posts
    70

    Question Modifying rows [still problems :-( ]

    Hi folks! Going crazy here. I got a dataset filled and now I need to modify a row of one of its tables. I know I can do it like this:

    Dataset.Table1.Rows(x).("Name")="John"

    Being x the row index. Now, I DON'T KNOW THE ROW INDEX of the row I want to modify, I know which row I want to change but HOW DO I FIND OUT ITS ROW INDEX SO THAT I CAN RUN THE COMMAND ABOVE?

    Thanks for your help!
    Last edited by nacho2; Dec 3rd, 2004 at 06:24 PM.

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

    Re: Modifying rows

    Use SQL UPDATE statement , using WHERE clause you can find the row by it's value .I'm sorry I can't give you an example now but try to search to save you some time.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 2004
    Posts
    70

    Re: Modifying rows

    Nope! Won't help!

    I'm not storing my data in a SQL DB. I'm storing my data in an xml document. But still that shouldn't make a diference, because what I'm trying to do now is to modify the dataset and once I've done that I'll update the DB (in my case an xml document). But even if I was working with an SQL DB I wouldn't know how to modify the row in the dataset.

    What I am implementing is a button_click that makes the field 'erased' of a row of a table to go from false to true.

    Thanks

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Nov 2004
    Posts
    70

    Re: Modifying rows [still problems :-( ]

    There is a bunch of command for selecting, updating and deleting rows of a dataset all of them used the row index... (like the command above) SO THERE HAS TO BE A WAY OF GETTING THE ROW INDEX, something like Dataset.Table.Rows.GetRowIndex("IdCustomer=2")...

    Any ideas? I appreciatte.

  5. #5
    New Member
    Join Date
    Sep 2005
    Posts
    8

    Re: Modifying rows [still problems :-( ]

    icurrentpos=me.bindingcontext(dataset,"table").position '+1 if you need an offset

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Modifying rows [still problems :-( ]

    So you're saying you know the primary key of the row? If so:
    VB Code:
    1. Dataset.Table1.Rows.Find(pkValue)("Name")="John"
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  7. #7
    Frenzied Member maged's Avatar
    Join Date
    Nov 2002
    Location
    Egypt
    Posts
    1,040

    Re: Modifying rows [still problems :-( ]

    icurrentpos=me.bindingcontext(dataset,"table").position '+1 if you need an offset
    and how does this relates to us

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