This update code is showing error and i dont know where the error is coming from, see error below
Server Error in '/' Application.
Incorrect syntax near ' QtyRemaining = 1980'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near ' QtyRemaining = 1980'.
Source Error:
Line 608: cmd.CommandText = "UPDATE Stock_Table SET RangeRemaining = " + updatedrange + "' QtyRemaining = " + updatedStock2 + "' WHERE Serial = '" + serial + "'";
Line 609: con.Open();
Line 610: inserted2 = cmd.ExecuteNonQuery();
code
ScriptManager.RegisterClientScriptBlock(btnorder2, this.GetType(), "alert", "<script>alert('Data Submitted Successfully ... !!')</script>", false);
}
if (inserted2 > 0)
{
int updatedStock2 = availableQuantity2 - quantity2;
int updatedrange = availableQuantityRang - availablerange;
using (SqlConnection con = new SqlConnection())
{
con.ConnectionString = str;
using (SqlCommand cmd = new SqlCommand())
{
cmd.CommandType = CommandType.Text;
cmd.Connection = con;
cmd.CommandText = "UPDATE Stock_Table SET RangeRemaining = " + updatedrange + " QtyRemaining = " + updatedStock2 + "' WHERE Serial = '" + serial + "'";
con.Open();
inserted2 = cmd.ExecuteNonQuery();
con.Close();