到/从SQL Server的文档保存/检索 [英] Document Save/Retreval to/from SQL Server
本文介绍了到/从SQL Server的文档保存/检索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要首先能够从SQL Server 2005中检索Word模板文档,以便用邮政信件的书签信息填充.
我已经使用Gooling一段时间了,所有结果都是使用FileUpload对象生成的ASP.NET,谁能告诉我Winforms的含义是什么?
谢谢.
I need to be able to primarily retrieve Word template documents from SQL Server 2005 to be filled with bookmark information for postal letters.
I have been Gooling for a while now and all the results are for ASP.NET using a FileUpload object can anyone tell me what the equivalent is for Winforms?
Thanks.
推荐答案
您可以使用 ^ ]在WinForms中.请参见同一页面上的示例.您可以将myStream
存储在SQL Server的"Image
"/"VarBinary
"数据类型中,并随时进行检索.
如果您需要一个示例如何在sql server中存储二进制内容,那么这是一个很好的示例. [ ^ ].
以下是使用SQL Server存储/检索文档的步骤
1)使用OpenFileDialog
读取二进制数组中的文件内容.
2)将二进制内容保存在sql server表中,该表的至少一列(FileContents
)的数据类型为Image
或VarBinary
,另一列的数据类型为FileName
VarChar
(255).
3)读取FileContents
列的内容,并将其保存在FileName
列的临时文件夹中.并从那里读取文件...
You can use OpenFileDialog[^] in WinForms. see the example on the same page. you can store themyStream
in the SQL Server ''Image
'' / ''VarBinary
'' datatype and retrieve it anytime.
If you need an example how to store binary contents in sql server then here is a nice example.[^].
Following are the steps to Store / Retrieve document using SQL Server
1) read the file contents in binary array usingOpenFileDialog
.
2) save the binary contents in sql server table, that has atleast one column (FileContents
) with data type eitherImage
orVarBinary
and another one withFileName
VarChar
(255).
3) Read the contents of theFileContents
column and save it in a temp folder with theFileName
column. and read the file from there...
这篇关于到/从SQL Server的文档保存/检索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文