如何在Datagridview中添加Doc文件 [英] How Do I Add Doc File In Datagridview

查看:98
本文介绍了如何在Datagridview中添加Doc文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

// Save the document to a MemoryStream object.
MemoryStream stream = new MemoryStream();
doc.Save(stream, SaveFormat.Doc);

string fileName = Path.GetFileName(doc.OriginalFileName);

// Create the SQL command.
row.Cells[1].Value =stream.ToArray(;

// Add the @Doc parameter.
command.Parameters.AddWithValue("Doc", stream.ToArray());

// Write the document to the database.
command.ExecuteNonQuery();

推荐答案

你能尝试吗?这个??

http://stackoverflow.com/questions/2579373/saving-any-file-to-in-the-database-just-convert-it-to-a-byte-array [ ^ ]
can you try this ??
http://stackoverflow.com/questions/2579373/saving-any-file-to-in-the-database-just-convert-it-to-a-byte-array[^]


这篇关于如何在Datagridview中添加Doc文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆