Home All Groups Group Topic Archive Search About

Visual Studio .net failure to store to database

Author
8 Oct 2005 10:49 PM
j.fitchett
Platform: Visual Studio 2005, c#, target smart device, Pocket PC
Problem:  .update method does not store data to database.

Background:
1. created a database on pocket pc with sql CE query analyzer.

2. created app with datagrid, mapped auto-generated dataset and
    databindings to this database.

3. Populated the database by sql analyzer with 2 records so I could
   insure app is using right DB

4. call fill to get initial data, notice grid shows 2 records as
expected.
      this.invoicesTableAdapter.Fill(this.comcashDataSet.Invoices);

5. Hit button to add new records, using dataset.addrow()
       comcashDataSet.Invoices.AddInvoicesRow(scurinv, cname, p[x].plu,

       p[x].desc, p[x].price, ftax, "O");
       comcashDataSet.Invoices.AcceptChanges();

6. When done adding items, call update to post them ( I thought! )
    resultcode = this.invoicesTableAdapter.Update(comcashDataSet.
    Invoices);
    *** Note result code returns 0 ***
7. Then reread the database to see if changes took
       invoicesTableAdapter.Fill(comcashDataSet.Invoices);

results in back to only 2 records, browsing table shows 2 records,
nothing I do seems to make the data stay past the current session.

what am I missing?

Author
10 Oct 2005 6:40 PM
Ilya Tumanov [MS]
You've accepted changes on step 5. That means DataAdapter on step 6 will do
nothing because DataSet is unchanged and there's nothing to update.


Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).

<j.fitch***@comcash.com> wrote in message
Show quote
news:1128811790.970138.108060@g43g2000cwa.googlegroups.com...
> Platform: Visual Studio 2005, c#, target smart device, Pocket PC
> Problem:  .update method does not store data to database.
>
> Background:
> 1. created a database on pocket pc with sql CE query analyzer.
>
> 2. created app with datagrid, mapped auto-generated dataset and
>    databindings to this database.
>
> 3. Populated the database by sql analyzer with 2 records so I could
>   insure app is using right DB
>
> 4. call fill to get initial data, notice grid shows 2 records as
> expected.
>      this.invoicesTableAdapter.Fill(this.comcashDataSet.Invoices);
>
> 5. Hit button to add new records, using dataset.addrow()
>       comcashDataSet.Invoices.AddInvoicesRow(scurinv, cname, p[x].plu,
>
>       p[x].desc, p[x].price, ftax, "O");
>       comcashDataSet.Invoices.AcceptChanges();
>
> 6. When done adding items, call update to post them ( I thought! )
>    resultcode = this.invoicesTableAdapter.Update(comcashDataSet.
>    Invoices);
> *** Note result code returns 0 ***
> 7. Then reread the database to see if changes took
>       invoicesTableAdapter.Fill(comcashDataSet.Invoices);
>
> results in back to only 2 records, browsing table shows 2 records,
> nothing I do seems to make the data stay past the current session.
>
> what am I missing?
>

AddThis Social Bookmark Button