Results 1 to 6 of 6

Thread: [2005] Modifying a dataset/tableadapter via code

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2006
    Posts
    54

    [2005] Modifying a dataset/tableadapter via code

    I have a couple of questions here. The first being, I have set up a bunch of fields to be databound to a sql server table. My first problem is how do I get the value of a field in the dataset(primary key in this case).

    My next question is, If I databind another set of fields to another table, if i fill my tableadapter with a custom sql string(ie select * from blah where primary_key = " & primarykey_val), will it update all the bound fields or is there a way to achieve this behavior?

    Thanks
    chris
    Last edited by UsefulIdiot; Aug 16th, 2006 at 04:34 PM.

  2. #2
    Fanatic Member
    Join Date
    Aug 2006
    Location
    Chicago, IL
    Posts
    514

    Re: [2005] DB Related

    Well to get the value it would be like this:

    VB Code:
    1. datasetvariable.Tables(0).Rows(index)("ColumnName")

    For the updating, I don't know.
    Warren Ayen
    Senior C# Developer
    DLS Software Studios (http://www.dlssoftwarestudios.com/)

    I use Microsoft Visual Studio 2005, 2008, working with Visual Basic and Visual C#
    Hey! If you like my post, or I solve your issue, please Rate Me!

  3. #3

    Thread Starter
    Member
    Join Date
    Jul 2006
    Posts
    54

    Re: [2005] DB Related

    Ok That works, but now, With having visually databound everything to controls, how can I via code modify that query and have all the values updated on the form? via the fill method on my tableadapter? I cant quite figure out this works.

  4. #4
    Fanatic Member
    Join Date
    May 2003
    Posts
    758

    Re: [2005] DB Related

    If you want to modify the query, then you would have to modify the query used by the command object that is referenced as the SelectCommand for the TableAdapter.
    My.Settings.Signature = String.Empty

  5. #5

    Thread Starter
    Member
    Join Date
    Jul 2006
    Posts
    54

    Re: [2005] DB Related

    Those methods and properties arent available(Intellisense doesnt show them generates compile errors) on the autogenerated ones for some reason, is there a way to make them available?

  6. #6
    Fanatic Member
    Join Date
    Aug 2006
    Location
    Chicago, IL
    Posts
    514

    Re: [2005] Modifying a dataset/tableadapter via code

    To modify the query, you create a new select command and fill the datadapter again.

    What do you mean they aren't available? Do you have a reference to System.Data?
    Warren Ayen
    Senior C# Developer
    DLS Software Studios (http://www.dlssoftwarestudios.com/)

    I use Microsoft Visual Studio 2005, 2008, working with Visual Basic and Visual C#
    Hey! If you like my post, or I solve your issue, please Rate Me!

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