我想在db sql server中存储docx或rar或png或pdf ..... [英] i want store docx or rar or png or pdf..... in db sql server

查看:79
本文介绍了我想在db sql server中存储docx或rar或png或pdf .....的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi


i想在db sql server中存储docx或rar或png或pdf .....



i没有商店的问题。我想在db中存储。



我的问题是在db中编辑



如何从db

hi
i want store docx or rar or png or pdf..... in db sql server

i dont problem with store .i want store in db.

my problem is edit in db

how download file docx or pdf from db

推荐答案

下载文件docx或pdf您可以在数据库中使用二进制数据类型。将文件数据和文件名分别存储在两列中。将文件数据作为字节。 C#有一种从文件中获取字节的方法:



File.ReadAllBytes [ ^ ]



获取字节数组并将其写入文件数据列。将文件名存储在另一列中。



当您将其读回时,只需在将字节输入字节数组后使用以下方法:



档案.WriteAllBytes [ ^ ]
You can probably make use of binary data type in your database. Store your file data and file name separately in two columns. Have file data as bytes. C# has a way to get bytes from a file:

File.ReadAllBytes[^]

Get the byte array and write it to the file data column. Store the file name in another column.

When you read it back, simply use the following method after getting the bytes into a byte array:

File.WriteAllBytes[^]






我使用了以下帮助。这真的对我有用。我希望这对你也有帮助。



url:http://www.c-sharpcorner.com/UploadFile/0c1bb2/uploading-and-downloading-word- files-from-database-using-as



只需根据你的项目要求修改代码......最好的运气



Avinash
Hi,

I used the following help. That really works for me. I hope this will help you also.

url : http://www.c-sharpcorner.com/UploadFile/0c1bb2/uploading-and-downloading-word-files-from-database-using-as

Just modify the code as per your project requirement... Best of Luck

Avinash


这篇关于我想在db sql server中存储docx或rar或png或pdf .....的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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