G
Guest
I am creating a database app in MSVS 2005. I have created the mobile database
and it seems to work with the program. I have inserted a few records for
testing in VS 2005. Those records show up iwhen the program runs in the
emulator.
I created a datagrid form by dragging the grid from the datasources page in
my app. after doing so I noticed a right pointing arrow at the top of the
grid allowing me to let MSVS build my summary and Edit forms. So I did.
However when I add a new horse or horses they seem to be saved to the table
and displayed in the datagrid, but only until I close the datagrid form(not
the application) then when I re open it the records I created while my app
was running in the emulator are no longer there. So I adde this code to the
close of the edit form, but still no luck in saving the records. Can anyone
tell me what Iam doing wrong.
this.horseBindingSource.EndEdit(); this was added by MSVS
I added this below:no errors but data not saved
FB7MobileDBDataSet fb7mobiledataset = new FB7MobileDBDataSet();
FB7MobileDBDataSet.HorseDataTable newhorse =
(FB7MobileDBDataSet.HorseDataTable)
fb7mobiledataset.Horse.GetChanges(DataRowState.Added);
try
{
if (newhorse !=null)
{
horseTableAdapter1.Update(newhorse);
}
fb7mobiledataset.AcceptChanges();
}
catch (System.Exception ex)
{
MessageBox.Show("UpdateFailed");
}
finally
{
if (newhorse != null)
{
newhorse.Dispose();
}
}
and it seems to work with the program. I have inserted a few records for
testing in VS 2005. Those records show up iwhen the program runs in the
emulator.
I created a datagrid form by dragging the grid from the datasources page in
my app. after doing so I noticed a right pointing arrow at the top of the
grid allowing me to let MSVS build my summary and Edit forms. So I did.
However when I add a new horse or horses they seem to be saved to the table
and displayed in the datagrid, but only until I close the datagrid form(not
the application) then when I re open it the records I created while my app
was running in the emulator are no longer there. So I adde this code to the
close of the edit form, but still no luck in saving the records. Can anyone
tell me what Iam doing wrong.
this.horseBindingSource.EndEdit(); this was added by MSVS
I added this below:no errors but data not saved
FB7MobileDBDataSet fb7mobiledataset = new FB7MobileDBDataSet();
FB7MobileDBDataSet.HorseDataTable newhorse =
(FB7MobileDBDataSet.HorseDataTable)
fb7mobiledataset.Horse.GetChanges(DataRowState.Added);
try
{
if (newhorse !=null)
{
horseTableAdapter1.Update(newhorse);
}
fb7mobiledataset.AcceptChanges();
}
catch (System.Exception ex)
{
MessageBox.Show("UpdateFailed");
}
finally
{
if (newhorse != null)
{
newhorse.Dispose();
}
}