New Record in New Form problem.
-
Hi I'm writing a db app with the following features : 1. have a list of items (FormReportItems) 2. for new Item and edit Item, the new form open (FormItem) 3. the new item or current item pass to FormItem constructor and return that specific item to update data in form list (FormReportItems), some thing like this :
AppDataSet.SampleTableRow itemNewRow = this.appDataSet.SampleTable.SampleTableRow();
FrmSampleTable frm = new FrmSampleTable(itemNewRow, this.appDataSet);
if (frm.ShowDialog() == DialogResult.OK)
{
this.appDataSet.SampleTable.AddSampleTableRow(itemNewRow);DataManager dm = new DataManager(); dm.SampleTableWithImages(this.appDataSet);
}
it work correctly while working in relational data. each item can some images in Images table, hence i must update data with images. my problem is to pass images table to FormItem and get result back to current form (FormReportItems) then update data. for this i've passed current dataSet to FrmSampleTable constructor as second parameter to hold inserted or edited images in FormSampleTable (FormItem), when FormSampleTable returns DialogResult.OK the dataBase must be update to commit changes. my problem is when i want to pass images dataTable to current dataSet, it does not have any records, wheras in FormSampleTable it have some records. can anybody help me about this issue ? what's your idea in Insert & Edit relational data Form ? thanks
-
Hi I'm writing a db app with the following features : 1. have a list of items (FormReportItems) 2. for new Item and edit Item, the new form open (FormItem) 3. the new item or current item pass to FormItem constructor and return that specific item to update data in form list (FormReportItems), some thing like this :
AppDataSet.SampleTableRow itemNewRow = this.appDataSet.SampleTable.SampleTableRow();
FrmSampleTable frm = new FrmSampleTable(itemNewRow, this.appDataSet);
if (frm.ShowDialog() == DialogResult.OK)
{
this.appDataSet.SampleTable.AddSampleTableRow(itemNewRow);DataManager dm = new DataManager(); dm.SampleTableWithImages(this.appDataSet);
}
it work correctly while working in relational data. each item can some images in Images table, hence i must update data with images. my problem is to pass images table to FormItem and get result back to current form (FormReportItems) then update data. for this i've passed current dataSet to FrmSampleTable constructor as second parameter to hold inserted or edited images in FormSampleTable (FormItem), when FormSampleTable returns DialogResult.OK the dataBase must be update to commit changes. my problem is when i want to pass images dataTable to current dataSet, it does not have any records, wheras in FormSampleTable it have some records. can anybody help me about this issue ? what's your idea in Insert & Edit relational data Form ? thanks
If I understand your question correctly, I believe what you are trying to accomplish is something like: -Pull data down from the database -Make local changes to the data -Update again from the database*** -Push your changes up to the server And the problem you are having is merging the datasets together. If this is what you are trying to do there are two routes of action I would consider: 1- is there any way around this, so you could avoid the problem completely? I suggest you take a step back, look through your code, and see if there is a different design strategy you could follow. If you could somehow remove the step where you update from that database again, the problem would probably be straight forward. 2- if you really do need to do something like this, I suggest checking out the Microsoft Sync Framework. It is designed to sync between multiple data connections, and in addition to making the updating easy, if conflicts happen it will detect those too. Take Data Offline Using Microsoft Synchronization Services for ADO.NET[^] that is a link that looks like a pretty good introduction to Harmonica. I honestly haven't read the entire article, but it looks like a good starting ground. Let me know if I misunderstood your question. -Ken