F
forum.microsoft.com
inserted record is present only in the dataset/bindingsource but not in the
sql table
same for updated record, changes is only in the dataset or the bindingsource
but not in the actual physical sql table.
If I refill from table I will not find any changes.
Also the primary key name in the inserted record field may get changed to
something like "system.data.row"
protected void saveclient(bool bFastSave)
{
if (bNew)
{
if (clientNameTextBox.Text == "")
{
setStatus("Please enter name of the new client");
return;
}
}
if (!bFastSave)
{ // edit
// omitted detail biz logic for editing
}
CurrencyManager cm =
(CurrencyManager)this.BindingContext[clientBindingSource, "client"];
cm.EndCurrentEdit();
if (bNew)
{
try
{
ClientTmpDataSet.client.AcceptChanges();
}
catch (System.ArgumentException ae)
{
setStatus("Length of client Name is not acceptable:" +
ClientTmpDataSet.client.clientNameColumn);
ClientTmpDataSet.client.RejectChanges();
return;
}
clientBindingSource.EndEdit();
this.clientTableAdapter.Update(((DataRowView)clientBindingSource.Current).Row);
bNew = false;
}
else
{ //not new record - update
try
{
ClientTmpDataSet.client.AcceptChanges();
}
catch (System.ArgumentException ae)
{
setStatus("Length of client Name is not acceptable:" +
ClientTmpDataSet.client.clientNameColumn);
return;
}
clientBindingSource.EndEdit();
this.clientTableAdapter.Update(((DataRowView)clientBindingSource.Current).Row);
};
bindingNavigator1.Enabled = true;
comboBoxclientName.Enabled = true;
setStatus("save done record count=" + cm.Count);
}
sql table
same for updated record, changes is only in the dataset or the bindingsource
but not in the actual physical sql table.
If I refill from table I will not find any changes.
Also the primary key name in the inserted record field may get changed to
something like "system.data.row"
protected void saveclient(bool bFastSave)
{
if (bNew)
{
if (clientNameTextBox.Text == "")
{
setStatus("Please enter name of the new client");
return;
}
}
if (!bFastSave)
{ // edit
// omitted detail biz logic for editing
}
CurrencyManager cm =
(CurrencyManager)this.BindingContext[clientBindingSource, "client"];
cm.EndCurrentEdit();
if (bNew)
{
try
{
ClientTmpDataSet.client.AcceptChanges();
}
catch (System.ArgumentException ae)
{
setStatus("Length of client Name is not acceptable:" +
ClientTmpDataSet.client.clientNameColumn);
ClientTmpDataSet.client.RejectChanges();
return;
}
clientBindingSource.EndEdit();
this.clientTableAdapter.Update(((DataRowView)clientBindingSource.Current).Row);
bNew = false;
}
else
{ //not new record - update
try
{
ClientTmpDataSet.client.AcceptChanges();
}
catch (System.ArgumentException ae)
{
setStatus("Length of client Name is not acceptable:" +
ClientTmpDataSet.client.clientNameColumn);
return;
}
clientBindingSource.EndEdit();
this.clientTableAdapter.Update(((DataRowView)clientBindingSource.Current).Row);
};
bindingNavigator1.Enabled = true;
comboBoxclientName.Enabled = true;
setStatus("save done record count=" + cm.Count);
}