我正在尝试使用PHP代码在AdventureWorks数据库中上传图片 我收到了一个错误。我已经进行了整个搜索,无法修复它。
错误代码
sqlsrv_execute()失败。行插入失败。错误信息:
SQLSTATE: 07002
Code: 0
Message: [Microsoft][ODBC Driver 11 for SQL Server]COUNT field incorrect or syntax error.
代码:
case 'uploadpicture':
$tsql = "INSERT INTO FotoFGS (LargePhoto)
VALUES (?); SELECT SCOPE_IDENTITY() AS PhotoID";
$fileStream = fopen($_FILES['file']['tmp_name'], "r");
$uploadPic = sqlsrv_prepare(
$conn,
$tsql,
array(&$fileStream,
SQLSRV_PARAM_IN,
SQLSRV_PHPTYPE_STREAM(SQLSRV_ENC_BINARY),
SQLSRV_SQLTYPE_VARBINARY('max')
)
));
sqlsrv_execute($uploadPic);
if ($uploadPic === false) {
die(FormatErrors(sqlsrv_errors()));
}
if (sqlsrv_execute($uploadPic) === false) {
echo "sqlsrv_execute() failed.\n";
echo "Row insertion failed.\n";
die(FormatErrors(sqlsrv_errors()));
}
非常感谢您的帮助。