0
错误1934年我得到一个错误,而atempting在我的表中更新行ZF 2 MS SQL Server上的更新
$adapter = new Zend\Db\Adapter\Adapter([
'driver' => 'Pdo_dblib',
'hostname' => 'SRVSQL',
'database' => 'TDEV',
'username' => 'sa',
'password' => 'xxxx'
]);
$update = $sql->update('F_ARTFOURNISS')
->set([
'AF_RefFourniss' => $fournRef,
'AF_PrixAch' => $fournPxAchat,
'AF_Remise' => $fournRemise,
'AF_CodeBarre' => $fournGenCode
])
->where(['AR_Ref' => $ref]);
try {
$statement = $sql->prepareStatementForSqlObject($update);
$results = $statement->execute();
} catch (Exception $e) {
echo $e->getMessage() . "\n";
}
我碰到下面的错误代码时,我尝试执行上面的代码:
Statement could not be executed (HY000 - 1934 - General SQL Server error: Check messages from the SQL Server [1934] (severity 16) [(null)] - -1 - 16)
我也试过在执行查询之前添加一些参数:
$adapter->query("SET ANSI_WARNINGS ON");
$adapter->query("SET ANSI_PADDING ON");
$adapter->query("SET ANSI_NULLS ON");
$adapter->query("SET QUOTED_IDENTIFIER ON");
$adapter->query("SET CONCAT_NULL_YIELDS_NULL ON");
这是查询字符串的示例波纹管生成:
UPDATE [F_ARTICLE] SET [AR_Design] = 'azertyuuio',[FA_CodeFamille] = 'J',[AR_PrixAch] = '153.47',[AR_PrixVen] = '145.7965',[AR_Coef] =“0.95 ',[AR_PoidsNet] ='0',[AR_UnitePoids] ='2'其中[AR_Ref] ='801-0198'
当我将此行粘贴到sql server management studio中时,它工作正常。这不适用于我的项目。
感谢您的帮助