我有一张位置
的图片string Imageloc = C:\\Documents and Settings\\All Users\\Documents\\My Pictures\\Sample Pictures\\Sunset.jpg
我使用以下查询在DB
中插入图像"UPDATE Employee SET Image = '(SELECT * FROM OPENROWSET(BULK N'" + Imageloc + "', SINGLE_BLOB) as Image)' WHERE EmployeeID = (SELECT MAX(EmployeeID) FROM Employee";
我收到以下异常
Incorrect syntax near '\\'.\r\nIncorrect syntax near 'Employee'
请告诉我如何解决它......我不知道如何将'\\'
从字符串中替换为'\'
答案 0 :(得分:0)
你的意思是:
"UPDATE Employee SET Image =
'(SELECT * FROM OPENROWSET(BULK N'" + Imageloc + "', SINGLE_BLOB) as Image)'
WHERE EmployeeID = (SELECT MAX(EmployeeID) FROM Employee)";
^