| VlH wrote: |
|
I don't understand why you can not use wizard, but maybe you have a course.
If you want to customise strongly-typed dataset, you can extend generated classes by using "partial" keyword. (All dataset classes aregenerated with this keyword). With this technique you can add additional methods and properties, and get access to dataset internals. But be carefull, if you modify internal data of dateset. | |
The wizard doesn't generate update statements because there is no primary key, and it doesn't let me specify the column to use as a unique column during the wizard. I do an add new, choose DataSet, and it takes me through the wizard. However, if the table I choose does not have a primary key, it does not let me specify a primary key, and therefore it does not generate update statements.
What I ended up doing is setting the pkey on the table, generating the dataset, then removing the pkey from the table in the database.
In the dataset editor, I selected my unique column, ands set the AllowDBNull to True and made sure Unique was set to true. This resolveed the issue I was having with my one blank record.
I had not reallized I could do this, but I found that if I click on the Adapter header in the designer that is named <TableName>Adapter, then it display the commands in the Properties windows. I can expand the Update command and edit the parameters and CommandText.
I even tried setting the primary key in the designer(but not the database), and right clicking the data table header in the designer, and clicking Configure. This would take me through the wizard again, but still Update statements were not genertated. If I set the primary key in the database, then it would generate them when I did this.
I just wish the DataSet designer would trust me when I tell it that the column is unique, and use that in the udpate and delete statements. Instead it examines the constraints in the database.
I got it working, though.
Edit: I thought I had posted this to the Data Access section, but somehow I ended up with it in Data Binding. Sorry about that.