Insert Delete And Update Problem

keko2004

Active member
Joined
Feb 13, 2006
Messages
39
Location
Middle Village, NY
Programming Experience
1-3
hey guys, ok my problem is that i have 2 tables in a db customers and customer address'. i created a dataadapter and configured the data adapter to contain both tables. now when i use the query builder it has no problem making the select statement. but i get errors whe it tries to make a INSERT DELETE AND UPDATE Statements. any help?
 
does the error stating that, the sqlserver is taking too long to ......etc etc?
(i got one)

so i change the query builder only updating 1 record per time and that solve the problem.
which means after i've finished udpate,etc.... immediately i call the adapter.update(ds,"sourceTableToUpdate").
 
data adapter can be use to display results from two table or more but it can only update or insert one table only, the table must be "pure" single table not a query result
 
Create your select query for the two combined tables, locate it and copy & paste it into notepad or somewhere.
Then create queries for each table seperately - that will allow the wizard to create the insert, update, and delete statements for the tables.

Manipulate the code with the select statement that you saved from the combined tables and you will be on the right track. You will have to do some tweeking to the code for loading and updating the datasets but the SQL statements will be generated for you by the wizard and should work just fine.

Also, this is generally considered a Master/Detail relationship and the dataform wizard will create a 2 datagrid form for you with insert, update, and delete capabilities. Give it a try also.
 
Back
Top