$sql = "Declare @v1 varchar(5000)";
$sql .= "Declare @v2 varchar(5000)";
$sql .= "Set @v1 = '";
$sql .= "<?xml version = \"1.0\"?>";
$sql .= "<Var1Data>";
$sql .= "<BodoOrder>";
$sql .= "<OrderNo>2016121201380</OrderNo>";
$sql .= "<Bodtype>订单</BodType>";
$sql .= "<xdate>2016-12-12</xdate>";
$sql .= "<DID>00</DID>";
$sql .= "<CID>104179</CID>";
$sql .= "<Contacter>111</Contacter>";
$sql .= "<Tel>13707165174</Tel>";
$sql .= "<address>测试地址</address>";
$sql .= "<BodNote>测试</BodNote>";
$sql .= "</BodoOrder>";
$sql .= "</Var1Data>'";
$sql .= "Set @v2 = '";
$sql .= "<?xml version = \"1.0\"?>";
$sql .= "<Var2Data>";
$sql .= "<BodoOrderDetails>";
$sql .= "<PID>14241</PID>";
$sql .= "<Color>金色</Color>";
$sql .= "<Size>90C</Size>";
$sql .= "<nQty>1</nQty>";
$sql .= "<nPrice>188.00</nPrice>";
$sql .= "</BodoOrderDetails>";
$sql .= "</Var2Data>'";
$sql .= "Exec LW2DRP @v1,@v2";
try {
$stmt = $dbh->prepare($sql);
$stmt->execute();
} catch (Exception $e) {
echo $e->getMessage();
}
报错:
Warning: PDOStatement::execute() [pdostatement.execute]: SQLSTATE[42000]: Syntax error or access violation: 102 [Microsoft][SQL Server Native Client 11.0][SQL Server]'' 附近有语法错误。
但是我把 命令输出以后 ,直接放到数据库去执行,是可以成功的。
1
lbp0200 2016-12-12 17:03:08 +08:00
pdo bind param
搜一下 |