我试图将图像上传到我的数据库,但我一直收到这个错误
'@Image'附近的语法不正确
有什么建议?
if (fileuploadImage.PostedFile != null &&
fileuploadImage.PostedFile.FileName != "")
{
//getting Name of Uploaded File
string strImageName = Profile.FirstName + Profile.LastName + "ProfileImage".ToString();
//getting length of uploaded file
int length = fileuploadImage.PostedFile.ContentLength;
//create a byte array to store the binary image data
byte[] imageSize = new byte[length];
//store the currently selected file in memeory
HttpPostedFile uploadedImage = fileuploadImage.PostedFile;
//set the binary data
uploadedImage.InputStream.Read(imageSize,0,length);
string connectionString =
ConfigurationManager.ConnectionStrings["NaviConnectionString"].ConnectionString;
string insertSql = "INSERT INTO UserProfiles(ImageName,Image) VALUES (@ImageName,@Image";
using (SqlConnection myConnection …Run Code Online (Sandbox Code Playgroud)