如何使用文件流将文件(5MB-50MB)上传到sql Server 2008 [英] How to upload files (5MB-50MB) into sql server 2008 by using filestream

查看:128
本文介绍了如何使用文件流将文件(5MB-50MB)上传到sql Server 2008的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!

我有一些文件,我需要使用文件流将这些文件上传到sql server 2008中.

让我们将表名作为custfile,
列是文件ID,文件名,文件路径,文件大小.

1.如何使用文件流创建表?
2.如何从.net环境中将文件(记录)插入表中?
3.如何从.net环境中检索该文件?

请提供相关代码....

感谢任何帮助

Hi!

I have some files, and i need to upload these files into sql server 2008 by using filestream.

lets take table name as custfiles,
columns are fileid,filename,filepath,filesize.

1.how to create table using filestream?
2.how to insert file (record) into table from .net environment?
3.how to retrive that file from .net environment?

please provide related code....

THANKS FOR ANY HELP

推荐答案

您可以使用 Blob [^ ]来执行此操作.从数据库检索Blob较慢.因此,另一种方法是将文件保存在服务器文件系统中,并将文件的路径保留在数据库表中.
You can make use of Blob[^] to do that. Blobs are slower to retrieve from the database. So, another approach will be to save the file in the server file system and keep the path of file in the database table.


这篇关于如何使用文件流将文件(5MB-50MB)上传到sql Server 2008的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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