简体   繁体   English

将文本文件插入数据库

[英]Inserting Text File into Database

I have visual studio 2010 with sql express. 我有带SQL Express的Visual Studio 2010。 Im trying to create a asp website that will display a file from a database, and need to insert a textfile or pdf into the database table, can this be done using the visual interface, all the intructions i have found is only using the sql insert command? 我正在尝试创建一个asp网站,该网站将显示数据库中的文件,并且需要在数据库表中插入文本文件或pdf,这可以使用可视界面来完成,我发现的所有指令都仅使用sql插入命令?

Thanks 谢谢

No you can't do this. 不,你不能这样做。 Basic UI interface means you can type it in, you can't type in an array of byte. 基本的UI界面意味着您可以输入它,而不能输入字节数组。

So that means code, it's not hard, but I would recommend you consider storing the a url / filename in the table and then putting the file on the file system instead of as a blob in the table. 因此,这意味着代码,这并不难,但我建议您考虑将url /文件名存储在表中,然后将文件放在文件系统中,而不是在表中作为Blob。

Files in database blobs does have some benefits for local deployment, in that you don't have to worry about some muppet making them inaccessible. 数据库Blob中的文件确实对本地部署有一些好处,因为您不必担心会造成无法访问的木偶。 Server side though that is far less of a worry. 服务器端虽然不必担心。 As long as you back up database and file system and come up with a reasonable directory and file naming structure its much less of a cost than bloating a database with a load of stuff you can't use in a query, not to mention it tends to make a fair mess of volume (mdb) file. 只要您备份数据库和文件系统并提供合理的目录和文件命名结构,其成本就比充斥大量您无法在查询中使用的东西膨胀数据库要少得多,更不用说它会使相当混乱的卷(mdb)文件。

Oh and there are persistant rumours that MS are going to drop blobs over 8000 bytes as well. 哦,还有持续的谣言,MS也将丢弃超过8000字节的Blob。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM