word文档的mysql数据库类型_关于word文档的数据库存取

这篇博客介绍了如何将Word文档存储到SQL Server数据库的image类型字段中,并通过C#代码实现上传和下载。在数据库中创建了一个包含id、name、blob和type字段的blob表,使用SqlCommand进行插入和查询操作,实现了文件的存取功能。
摘要由CSDN通过智能技术生成

本人是将要存取的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&#

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值