• Advertisement
Sign in to follow this  

SQL in VB.NET accessing data in related tables

This topic is 4329 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am just getting started using ADO.NET. I am trying to access data in a access database. The database has two tables that are related by a single primary key. The query builder in MS VB.NET can not create the SQL update insert or delete statement. The select statement works fine. I have the basic syntax for these SQL Statements but don't have any idea where to go from here. I can't change the database though I wish I could. Any help would be great - Thaks.

Share this post


Link to post
Share on other sites
Advertisement
Is the primary key defined in your dataset, or actually in the database?

If you define data relations in the dataset designer, it doesn't have enough info to generate insert or update commands as it isn't at all clear if the table has a physical counterpart, nor does it have update ordering info which is very important in updating related tables. This is unlike direct table mapping with clearly defined primary keys.

You can supply the needed commands in the dataset designer in either case, though, so you have full control on the back-end statements. To define your own commands, manipulate the corresponding properties of your table adapter. Visual Studio will provide SQL editors for these.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement