这是我用来更新表的更新查询.它抛出一个异常"在哪里附近的语法不正确"为什么这个例外?我不知道.
public bool UpdateLocationCountintoMerchantPackage(int PackageID, long MerchantID,int LocationCount)
{
try
{
SqlParameter[] parameters = new SqlParameter[]
{
new SqlParameter("@packageID",PackageID),
new SqlParameter("@merchantID",MerchantID ),
new SqlParameter("@locationCount",LocationCount )
};
string CommandText = string.Empty;
CommandText = "Update Merchant_Package SET LocationCount Where MerchantID=@MerchantID";
string ConnectionString = DbConnectionStrings.GetDbConnectionString();
SqlHelper.ExecuteNonQuery(ConnectionString, System.Data.CommandType.Text, CommandText, parameters);
return true;
}
catch (SqlException ex)
{
LogError("Error Occurred When Saving Merchant Location Count Data : MerchantID:" + MerchantID.ToString(), ex);
return false;
}
}
Run Code Online (Sandbox Code Playgroud)
这个函数是从
protected void imgbtnSubmit_Click(object sender, ImageClickEventArgs e)
{
UpdatePaymentInfo();
string QueryString = Request.QueryString.ToString();
if (string.Equals(QueryString, "MerchantProfilePages"))
{
Response.Redirect(ApplicationData.URL_ADD_PROFILE_PAGE, false);
Merchant mrchnt = new Merchant();
int PackId = mrchnt.PackageID;
int x = GetLocationCount() + 1;
mrchnt.UpdateLocationCountintoMerchantPackage(PackId, merchantId, x);
}
Run Code Online (Sandbox Code Playgroud)
cod*_*ger 13
这是你的"SET LocationCount"的一个问题 - 你没有把它设置为任何东西.这就是为什么它抱怨WHERE.
| 归档时间: |
|
| 查看次数: |
1560 次 |
| 最近记录: |