帮我看看INSERT语句......
根据网址传来的值out_trade_no,查询表Orders当中的OrderId,根据OrderId字段更新表OrderStatus当中的status的值.表Orders和表OrderStatus用OrderId关联.可我写如下语句后,并没有更新成功.也没有任何提示,请问原因.
CS:
{
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings[ "SQLConnString1 "].ConnectionString);
SqlCommand updatecmd = new SqlCommand( "INSERT INTO OrderStatus (Status) values (@Status) where Orders.CreditCard=@out_trade_no and OrderStatus.OrderId=Orders.Orderid ", conn);
updatecmd.Parameters.Add(new SqlParameter( "@out_trade_no ", SqlDbType.VarChar, 50));
updatecmd.Parameters.Add(new SqlParameter( "@Status ", SqlDbType.VarChar, 50));
string out_trade_no = Request.QueryString[ "out_trade_no "];
if (out_trade_no == null)
{
//没有此订单号,就出错.
Response.Write( "测试请带?out_trade_no=20070227231126968 ");
}
else
{
updatecmd.Parameters[ "@out_trade_no "].Value = out_trade_no;
updatecmd.Parameters[ "@Status "].Value = "32222222 ";
}
}
[解决办法]
帮LZ顶
[解决办法]
一般我都是这样( "INSERT INTO OrderStatus (Status) values ( ' "+@Status+ " ') where Orders.CreditCard= "+@out_trade_no+ " and OrderStatus.OrderId=Orders.Orderid "
不知道还可以像lz那样用~~
[解决办法]
SqlCommand updatecmd = new SqlCommand( "INSERT INTO
前面是 updatecmd 后面却写 INSERT INTO ?