please this update query sets update on one row, but i want to update SET Dept=@Dept And Credit=@Credit
here is my query
if (inserted > 0)
{
float updatedebt = olddebt + grandtotal;
float sum = updatedebt;
using (SqlConnection con = new SqlConnection())
{
con.ConnectionString = str;
using (SqlCommand cmd = new SqlCommand())
{
cmd.CommandType = CommandType.Text;
cmd.Connection = con;
cmd.CommandText = "UPDATE CustomerDetail SET Debt=@Debt WHERE CustomerPhone = @CustomerPhone";
cmd.Parameters.AddWithValue("@PaymentStatus", paymentstatus);
// cmd.Parameters.AddWithValue("@AmountPaid", txtamountpaid.Text.Trim());
cmd.Parameters.AddWithValue("@Debt", updatedebt);
// cmd.Parameters.AddWithValue("@Balance", grandtotal);
cmd.Parameters.AddWithValue("@CustomerPhone", ddlcustomerphone.SelectedItem.Text);
con.Open();
inserted = cmd.ExecuteNonQuery();
con.Close();
}
}
}
BindProductsSells();
}