|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Using the Data Adapter designerI am using VS2003. When using the design enviroment to create a data Adapter wth a single table, no problems but... I used a data adapter to join three 1 to 1 tables. First thing I noticed is that it immediately cross joins all the tables(?) . I had to manually create the joins which is ok but what's the point if it's meant to be a 'designer'. I then finished the Da by clicking Finish. (It failed to create Update, delete & Insert commands). From this I generated a data set, filled it & bound it to a data grid. The grid displayed all required columns from the 3 tables fine. I put an daMyDataAdapter.Update(dsMyDataSet); into the click event of the datagrid to test it. When I change a value on the data grid then click it, I get an error: Additional information: Update requires a valid UpdateCommand when passed DataRow collection with modified rows. What am i doing wrong? Are these vs2003 bugs that I must work around? Thanks for any suggestions in advance Ant The Autogenerate tools can't generate update logic for queries with joins or
without primary keys. Show quote "Ant" <A**@discussions.microsoft.com> wrote in message news:A365A34B-E4E3-4C47-91DA-08F365EB6CFA@microsoft.com... > Hi, > > I am using VS2003. > > When using the design enviroment to create a data Adapter wth a single > table, no problems but... > > I used a data adapter to join three 1 to 1 tables. First thing I noticed > is > that it immediately cross joins all the tables(?) . I had to manually > create > the joins which is ok but what's the point if it's meant to be a > 'designer'. > I then finished the Da by clicking Finish. (It failed to create Update, > delete & Insert commands). From this I generated a data set, filled it & > bound it to a data grid. The grid displayed all required columns from the > 3 > tables fine. > > I put an daMyDataAdapter.Update(dsMyDataSet); into the click event of the > datagrid to test it. > > When I change a value on the data grid then click it, I get an error: > > Additional information: Update requires a valid UpdateCommand when passed > DataRow collection with modified rows. > > What am i doing wrong? Are these vs2003 bugs that I must work around? > > Thanks for any suggestions in advance > Ant Primary keys on your tables? That can throw things off.
Note the wizards are great if you fit within the scenarios envisioned. As soon as you take one step out, you end up with custom software. I would consider a view on top of the table if you are going to use the designers as it will "pre-aggregate" the information in your subclassed (assumption) tables. You will most likely end up with a bit of work in your INSERT, UPDATE and DELETE sprocs, but it is not that bad. The other option is to throw out the designers and write a bit of reuseable custom code that fits your model. -- Show quoteGregory A. Beamer MVP; MCP: +I, SE, SD, DBA *************************** Think Outside the Box! *************************** "Ant" wrote: > Hi, > > I am using VS2003. > > When using the design enviroment to create a data Adapter wth a single > table, no problems but... > > I used a data adapter to join three 1 to 1 tables. First thing I noticed is > that it immediately cross joins all the tables(?) . I had to manually create > the joins which is ok but what's the point if it's meant to be a 'designer'. > I then finished the Da by clicking Finish. (It failed to create Update, > delete & Insert commands). From this I generated a data set, filled it & > bound it to a data grid. The grid displayed all required columns from the 3 > tables fine. > > I put an daMyDataAdapter.Update(dsMyDataSet); into the click event of the > datagrid to test it. > > When I change a value on the data grid then click it, I get an error: > > Additional information: Update requires a valid UpdateCommand when passed > DataRow collection with modified rows. > > What am i doing wrong? Are these vs2003 bugs that I must work around? > > Thanks for any suggestions in advance > Ant Thanks cowboy,
I don't mind writing the code, I was just confused as to the purpose of a designer. Coming from ADO where a lot of the original designer & binding mindset was abandoned early in the piece, I'm now trying to work out how much (or which aspects) of the new .NET I should take on board, what are bugs and what is good practice. Thanks for your comments. Much appreciated Show quote "Cowboy (Gregory A. Beamer) - MVP" wrote: > Primary keys on your tables? That can throw things off. > > Note the wizards are great if you fit within the scenarios envisioned. As > soon as you take one step out, you end up with custom software. I would > consider a view on top of the table if you are going to use the designers as > it will "pre-aggregate" the information in your subclassed (assumption) > tables. You will most likely end up with a bit of work in your INSERT, UPDATE > and DELETE sprocs, but it is not that bad. > > The other option is to throw out the designers and write a bit of reuseable > custom code that fits your model. > > -- > Gregory A. Beamer > MVP; MCP: +I, SE, SD, DBA > > *************************** > Think Outside the Box! > *************************** > > > "Ant" wrote: > > > Hi, > > > > I am using VS2003. > > > > When using the design enviroment to create a data Adapter wth a single > > table, no problems but... > > > > I used a data adapter to join three 1 to 1 tables. First thing I noticed is > > that it immediately cross joins all the tables(?) . I had to manually create > > the joins which is ok but what's the point if it's meant to be a 'designer'. > > I then finished the Da by clicking Finish. (It failed to create Update, > > delete & Insert commands). From this I generated a data set, filled it & > > bound it to a data grid. The grid displayed all required columns from the 3 > > tables fine. > > > > I put an daMyDataAdapter.Update(dsMyDataSet); into the click event of the > > datagrid to test it. > > > > When I change a value on the data grid then click it, I get an error: > > > > Additional information: Update requires a valid UpdateCommand when passed > > DataRow collection with modified rows. > > > > What am i doing wrong? Are these vs2003 bugs that I must work around? > > > > Thanks for any suggestions in advance > > Ant |
|||||||||||||||||||||||