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
Bineesh Viswanath
NA
1k
777.9k
ADO.NET DATAGRIDVIEW UPDATE
Jul 20 2013 2:47 AM
Sir, I am doing a Program of ADO.NET
SAVE, UPDATE
and
DELETE
My form's name is frmProduct.
I want your help in the update process.
here is my form;
I did the coding for functioning Save and View.
the data passes from gridView to textBox when I double click in gridView and text of button Save change to "Update".
and I need your help from here.
I am getting error"
here is the code I wrote in the SP class;
public void productEdit(productInfo infoProduct)
{
try
{
if (sqlCon.State == ConnectionState.Closed)
{
sqlCon.Open();
}
SqlCommand sqlCmd = new SqlCommand("productEdit", sqlCon);
sqlCmd.CommandType = CommandType.StoredProcedure;
sqlCmd.Parameters.Add("@productId", SqlDbType.Decimal).Value = infoProduct.productId;
sqlCmd.Parameters.Add("@productName", SqlDbType.NVarChar).Value = infoProduct.productName;
sqlCmd.Parameters.Add("@purchaseRate", SqlDbType.Decimal).Value = infoProduct.purchaseRate;
sqlCmd.Parameters.Add("@salesRate", SqlDbType.Decimal).Value = infoProduct.salesRate;
int incount = sqlCmd.ExecuteNonQuery();
if (incount > 0)
{
MessageBox.Show("Update Successfully");
}
}
catch (Exception ex)
{
MessageBox.Show("PrSP04" + ex.Message);
}
finally
{
sqlCon.Close();
}
}
here the code I wrote in the button_click event
private void btnSave_Click(object sender, EventArgs e)
{
productInfo infoproduct=new productInfo();
productSP SpProduct=new productSP();
infoproduct.productId = decProduct;
infoproduct.productName = txtProductName.Text.ToString();
infoproduct.purchaseRate = decimal.Parse(txtpurchaseRate.Text);
infoproduct.salesRate = decimal.Parse(txtsalesReport.Text);
if (btnSave.Text == "Save")
{
SpProduct.productAdd(infoproduct);
}
else
{
SpProduct.productEdit(infoproduct);
}
ProductgridFill();
clearAll();
}
please help m
e i
n this error
Reply
Answers (
14
)
How to open an specific application when connecting a USB?
how to upload data from excel in sql server 2008 in .net?