16,010,488 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by tommmyyy123 (Top 5 by date)
tommmyyy123
27-Sep-11 3:53am
View
In btnSave_Click and btnUpdate_Click I put the following code:
private void btnDelete_Click(object sender, EventArgs e)
{
System.Data.SqlClient.SqlCommandBuilder cb;
cb = new System.Data.SqlClient.SqlCommandBuilder(da);
DataSet ds1 = new DataSet();
da.Fill(ds1, "Workers");
//MessageBox.Show(i.ToString());
ds1.Tables["Workers"].Rows[i].Delete();
da.Update(ds1, "Workers");
MaxRows--;
i--;
NavigateRecords();
label4.Text = "Record " + (i+1).ToString() + " from " + MaxRows.ToString();
MessageBox.Show("Data Deleted");
}
and
private void btnUpdate_Click(object sender, EventArgs e)
{
System.Data.SqlClient.SqlCommandBuilder cb;
cb = new System.Data.SqlClient.SqlCommandBuilder(da);
DataSet ds1 = new DataSet();
da.Fill(ds1, "Workers");
DataRow dRowUp = ds1.Tables["Workers"].Rows[i];
dRowUp[1] = textBox1.Text;
dRowUp[2] = textBox2.Text;
dRowUp[3] = textBox3.Text;
da.Update(ds1, "Workers");
MessageBox.Show("Data Update");
label4.Text = "Record " + (i + 1).ToString() + " from " + MaxRows.ToString();
}
and now it's OK. Thank's
tommmyyy123
27-Sep-11 2:30am
View
I try this
tommmyyy123
27-Sep-11 2:29am
View
No, it's a good ideea
tommmyyy123
26-Sep-11 17:20pm
View
But, this error was heppend ONLY when I Add + Save +Delete record. If I want to delete any record, but not the last Add, the program work.
tommmyyy123
26-Sep-11 17:02pm
View
YES