如何插入到sqlserver2008为varchar文件:您好,
我要插入任何文件如Word或PDF ......到sqlserver的数据类型为varchar。
如何插入VARCHAR文件
请帮我
我用这个代码,但没有奏效
if (FileUpload1.FileName != "")
{
string filePath = Server.MapPath(" /pp/") + FileUpload1.FileName;
string ext = Path.GetExtension(FileUpload1.FileName);
switch (ext)
{
case ".doc":
contenttype = "application/vnd.ms-word";
break;
case ".docx":
contenttype = "application/vnd.ms-word";
break;
}
FileUpload1.SaveAs(filePath);
StreamReader myFile = new System.IO.StreamReader(filePath);
myString = myFile.ReadToEnd();
myFile.Close();
但它在我的数据库中插入: -
??:7932936 |会员