Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
4
Reply
update query executed but record not updated
Atul Rokade
Feb 16 2017 1:36 PM
207
Reply
Hi all,
Iam doing one task where i want to executed update query i have table name is Medicine_Available_Detail here iam storing total medicine available column name is Availability,I have one datagridview where im putting Quantity of that Medicine after user enter
Quantity of particular medicine then it table update as Availability-Quantity for that medicine i written a code but its executed but record not updated
private void dataGridView1_RowLeave(object sender, DataGridViewCellEventArgs e)
{
int quantity = Convert.ToInt16(dataGridView1.Rows[e.RowIndex].Cells["Quantity"].Value);
cmd = new OleDbCommand("update Medicine_Available_Detail set [Availability]=[Availability]-@Quantity where [Medicine_Name]=@Medicine_Name", con);
cmd.Parameters.AddWithValue("@Quantity", quantity);
cmd.Parameters.AddWithValue("@Medicine_Name", medicinename);
con.Open();
int n = cmd.ExecuteNonQuery();
con.Close();
}
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
4
)
Next Recommended Forum
Query group before and has numbered in access 2003 ?
Three tier Architecture