unable to update profile picture using varbinary

后端 未结 1 1588
野的像风
野的像风 2021-01-25 01:03

I\'m trying to update my profile picture using varbinary (SQL Server 2008). It don\'t seem to update the picture that I put in the fileupload. Below is the code I use to update

1条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-25 01:19

    try this:

    ...
    
    //insert the file into database
    
    string strQuery = "Update LoginRegisterOthers Set profilepic = (SELECT BULKCOLUMN FROM OPENROWSET(BULK N'"+filename+"',  SINGLE_BLOB) AS FIle_picture)  Where username = '" + username + "'";
    
    ...
    

    You can load a file directly with sql.

    0 讨论(0)
提交回复
热议问题