private void btnupdate_Click(object sender, EventArgs e) { int a = dataGridView1.CurrentRow.Index; string x = (dataGridView1.Rows[a].Cells[1].Value).ToString(); string y = (dataGridView1.Rows[a].Cells[3].Value).ToString(); int z = Convert.ToInt32(x); double u = Convert.ToDouble(y); obj.UPDATE_CUSTOMER(z, u); } CLASS LIBRARY ---------------- public IDataReader UPDATE_CUSTOMER(int customer_id, Double customer_mobile_no) { try { DbCommand com = db.GetStoredProcCommand(USP_Update_Customer_Data); db.AddInParameter(com, USP_Update_Customer_Data_PARAM_1, DbType.Int32, customer_id); db.AddInParameter(com, USP_Update_Customer_Data_PARAM_2, DbType.Double, customer_mobile_no); return db.ExecuteReader(com); } catch (Exception) { throw; } catch (Exception) { throw; } } // UPDATE CUSTOMER DATA private const string USP_Update_Customer_Data = "USP_Update_Customer_Data"; private const string USP_Update_Customer_Data_PARAM_1 = "customer_mobile_no"; private const string USP_Update_Customer_Data_PARAM_2 = "customer_id"; }
DATABASE TABLE WITH STORED PROCEDURE ----------------------------------------- CUSTOMER_MOBILE_NO BIGINT,
ERROR ----------- SQLEXCEPTION WAS UNHANDLED Error converting data type float to int. --------------------
CUSTOMER_MOBILE_NO BIGINT
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)