TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
alen aryana
NA
1
966
big problem by edit and delete rows from datagreadeview
Nov 16 2014 12:31 PM
hi my dear friends,i create a project by visual studio 2012 and now im have two problem white this project:
1) when i select a row from datagreadeview and press delete button the rows are delete but not delete from database(my database is access) and my curent code for this button:
-------------------------------------
private void hazf_Click(object sender, EventArgs e)
{
if (this.dataGridView1.SelectedRows.Count > 0)
{
dataGridView1.Rows.RemoveAt(this.dataGridView1.SelectedRows[0].Index);
}
}
----------------------------------------
2) when i select a row from datagradeview and press edit button,im going into edit form and im edit the data,but when i press the save button my row is edited and saved but by a big problem,my all rows change to edited row!
my code for edit button in edit form:
-----------------------------------------------------
private void button1_Click(object sender, EventArgs e)
{
oleDbCommand1.Parameters.Clear();
oleDbCommand1.CommandText = "UPDATE ssbm SET name=@n,family=@f,shparvande=@s,tell=@t,kolebedehi=@k,harghest=@h,aghsatemoavagh=@a,mablaghemoavagh=@m,bishtar=@b";
oleDbCommand1.Parameters.AddWithValue("@n", txtProNet1.Text);
oleDbCommand1.Parameters.AddWithValue("@f", txtProNet2.Text);
oleDbCommand1.Parameters.AddWithValue("@s", txtProNet3.Text);
oleDbCommand1.Parameters.AddWithValue("@t", txtProNet4.Text);
oleDbCommand1.Parameters.AddWithValue("@k", txtProNet5.Text);
oleDbCommand1.Parameters.AddWithValue("@h", txtProNet6.Text);
oleDbCommand1.Parameters.AddWithValue("@a", txtProNet7.Text);
oleDbCommand1.Parameters.AddWithValue("@m", txtProNet8.Text);
oleDbCommand1.Parameters.AddWithValue("@b", richTextBox1.Text);
oleDbConnection1.Open();
oleDbCommand1.ExecuteNonQuery();
oleDbConnection1.Close();
MessageBox.Show("saved!");
fedit.ActiveForm.Close();
}
----------------------------------------------
please help me,tanx
Reply
Answers (
1
)
Table Column Set
ip address & Location of user