|
-
Aug 16th, 2006, 03:21 PM
#1
Thread Starter
Member
[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.
-
Aug 16th, 2006, 03:24 PM
#2
Fanatic Member
Re: [2005] DB Related
Well to get the value it would be like this:
VB Code:
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!
-
Aug 16th, 2006, 04:02 PM
#3
Thread Starter
Member
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.
-
Aug 16th, 2006, 04:28 PM
#4
Fanatic Member
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
-
Aug 16th, 2006, 04:31 PM
#5
Thread Starter
Member
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?
-
Aug 17th, 2006, 10:17 AM
#6
Fanatic Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|