将PPt上载到Sql Server [英] Upload PPt to Sql Server
问题描述
先生,
如何使用ASP应用程序在SQL Server中上载Powerpoint演示文稿
以及如何向用户显示上传的PPT
请帮助我....
请参阅示例表.
创建表格uploadtest ( id int 主键, 文件名varchar( 500 ), 文件内容varbinary(max) )
我在下面的线程中附有一个示例工作解决方案以进行演示.
http://www.c- sharpcorner.com/Forums/Thread/179342/如何从database.aspx上传和检索文件
出于演示目的,我已设置为仅上传和下载一个文件.
我也使用了Entity框架,如果您使用的是存储过程,请使用上述列作为属性创建一个类,并设置值或将存储的proc内容直接传递给文件名和文件内容.
您只需上传ur ppt并测试其工作原理
将表作为
id int主键,
文件名varchar(500),
文件内容varbinary(max)
如果(FileUpload1.HasFile)
{
字符串fileName = FileUpload1.PostedFile.FileName;
字符串fileExtension = Path.GetExtension(FileUpload1.PostedFile.FileName);
byte [] document = FileUpload1.FileBytes;
}
现在编写查询以将文档插入数据库中
跟随这些链接
http://www.intstrings.com/ramivemula/asp-net/save-files-to-a-table-in-database-using-fileupload-control/
http://www.intstrings.com/ramivemula/asp-net/retrieve-files-from-a-table-in-database-using-generic-handler/
>
Sir,
How to upload Power point presentation in sql server using asp application
and also how to show uploaded PPT to user
Please help me....
Please see the sample table.
create table uploadtest ( id int primary key, filename varchar(500), filecontent varbinary(max) )
I have attached a sample working solution for demo purposes in the below thread.
http://www.c-sharpcorner.com/Forums/Thread/179342/how-to-upload-and-retrieve-files-from-database.aspx
For demo purposes i have set to upload and download one file only.
Also i have used Entity framework, if you are using stored procedures, create a class with the above columns as properties and set the values or directly pass the stored proc content to filename and file content.
You can just upload ur ppt and test how it works
Take Table as
id int primary key,
filename varchar(500),
filecontent varbinary(max)
if (FileUpload1.HasFile)
{
string fileName = FileUpload1.PostedFile.FileName;
string fileExtension = Path.GetExtension(FileUpload1.PostedFile.FileName);
byte[] document = FileUpload1.FileBytes;
}
and now write Query to insert document into Database
follow these links
http://www.intstrings.com/ramivemula/asp-net/save-files-to-a-table-in-database-using-fileupload-control/
http://www.intstrings.com/ramivemula/asp-net/retrieve-files-from-a-table-in-database-using-generic-handler/
这篇关于将PPt上载到Sql Server的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!