本人是将要存取的Word文档信息在数据库中设置成image类型
blob image 16 即为定义的文档变量
input a word document into the sql-server storage
notice :
the type of word document in sql-server database is image
the table structure in sql-serve
blob表
id int 4 0
name char 50
blob image 16
type char 60
protected void Button1_Click(object sender, EventArgs e)
{
//File1 is a component of c# is Fileupload
Stream imgdatastream = File1.PostedFile.InputStream;
int imgdatalen = File1.PostedFile.ContentLength;
string imgtype = File1.PostedFile.ContentType;
string name = this.File1.PostedFile.FileName;
byte[] imgdata = new byte[imgdatalen];
int n = imgdatastream.Read(imgdata, 0, imgdatalen);
string connstr = "Data Source=LIU;Initial Catalog=YJSBDB;User ID&#