में SQL सर्वर कॉलम में प्लस वन (+1) को कैसे जोड़ें, सरल सवाल यह है कि, आप एमएस क्वेरी में फ़ील्ड मान कैसे बढ़ाते हैं? मैं एक parametrized विधि का उपयोग कर अपने SQL सर्वर डेटाबेस में int
कॉलम में 1 (+1) जोड़ने की कोशिश कर रहा हूं। एक चर पर i ++ ऑपरेशन के समान।SQL क्वेरी
Incorrect syntax near '+'.
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 '+'.
Source Error:
Line 315:
Line 316: conn.Open();
Line 317: updatesuccess = sqlcmd.ExecuteNonQuery();
Line 318: conn.Close();
Line 319:Source File: c:\testdevlocation\appname\App_Code\ClassFileName.cs Line: 317
इस पर कोई सलाह:
public static int UpdateFieldCount(int parameterId)
{
// variable to hold the number of rows updated or the success of the query
int updatesuccess = 0;
// build your connection string
string connectionstring = WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
SqlConnection conn = new SqlConnection(connectionstring);
// build your SQL Query statement
string SQLString = "UPDATE TableName SET TableField + 1 WHERE SomeFilterField = @ParameterID";
SqlCommand sqlcmd = new SqlCommand(SQLString, conn);
sqlcmd.Parameters.AddWithValue("@ParameterID", parameterID);
conn.Open();
updatesuccess = sqlcmd.ExecuteNonQuery();
conn.Close();
return updatesuccess;
}
इस विधि मेरी एसक्यूएल क्वेरी में धन चिह्न (+) से संबंधित निम्न त्रुटि फेंक रहा है: मैं निम्नलिखित विधि का उपयोग कर रहा हूँ?