473,321 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

what is wrong with save code

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)clien tBindingSource.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)clien tBindingSource.Current).Row);
};
bindingNavigator1.Enabled = true;
comboBoxclientName.Enabled = true;
setStatus("save done record count=" + cm.Count);
}
Nov 24 '07 #1
1 1569
On 24 Nov, 22:45, "forum.microsoft.com" <news...@noMail.comwrote:
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)clien tBindingSource.Current).R-ow);
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)clien tBindingSource.Current).R-ow);
};

bindingNavigator1.Enabled = true;
comboBoxclientName.Enabled = true;
setStatus("save done record count=" + cm.Count);
}
http://forums.microsoft.com/MSDN/Sho...55835&SiteID=1
might help
Nov 25 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

220
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have...
137
by: Philippe C. Martin | last post by:
I apologize in advance for launching this post but I might get enlightment somehow (PS: I am _very_ agnostic ;-). - 1) I do not consider my intelligence/education above average - 2) I am very...
125
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from...
7
by: MrNobody | last post by:
I was a Java developer so I'm used to using property files as a means to keep configuration settings for my apps. I'm wondering what options are there with ..NET? Some settings I want to include...
9
by: Alan Silver | last post by:
hello, I am writing my first real ASP.NET application, but am getting a bit confused with ADO.NEt and the best way to use it. My old method (with Classic ASP) was to have a function that you...
3
by: JaRudzik | last post by:
Hello Try to add some blank text field and refresh window in IE it is ok but in firefox input hide_show works wrong , why ? Somebody can help me ? I'm not good in JS beacause I'm PHP coder ...
3
by: shapper | last post by:
Hello, In my Page's VB.NET code I am changing the value of the Profile property NAME. Profile.Name = tbName.Text However, I need to change this property value from a class in my App_Code...
2
by: shapper | last post by:
Hello, I have an ASP.NET page and in its runtime code I am trying to get an user profile, change it and save it. It works if I use Profile, which is the profile for the current authenticated...
2
by: monsalvo | last post by:
What's so wrong with my code? This line is part of a VBScript soap client part of a DTS wich is functional in a 90 percent. strText = .responseXML.selectSingleNode("//" login "loginReturn") ...
2
by: raylopez99 | last post by:
I can't get the below code to work, no matter how many times I change it. I do have the Image file, Image1, created (in another method), and using "hard coding" I can save it (it's a filled...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.