我们如何检索SQL数据库中的pdf文件 [英] How we can retrieve pdf file fron sql database

查看:80
本文介绍了我们如何检索SQL数据库中的pdf文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友
您能给我我如何从sql数据库中检索pdf文件的解决方案吗?
目前,我正在使用.net Framework 4.0和sql 2008

hello friends
can u please give me solution for how we can retrieve pdf file from sql database.
currently i am working with .net framework 4.0 and sql 2008

推荐答案

请参见
http://chiragrdarji.wordpress.com/2007 /08/31/storing-and-retrieving-docpdfxls-files-in-sql-server/ [
See
http://chiragrdarji.wordpress.com/2007/08/31/storing-and-retrieving-docpdfxls-files-in-sql-server/[^]


protected void Page_Load(object sender, EventArgs e)
{
int imageid = Convert.ToInt32(Request.QueryString["ACTUAL_IMAGE_PDF"]);SqlDataReader imageContent = GetImage(imageid);
 
imageContent.Read();
Response.ContentType = imageContent["ImageType"].ToString();
 
Response.OutputStream.Write((byte[])imageContent["ImageFile"], 0, System.Convert.ToInt32(imageContent["ImageSize"]));
Response.End();
}
private SqlDataReader GetImage(int imageid)
{
 
SqlConnection myConnection = new SqlConnection("Data Source=*********");SqlCommand myCommand = new SqlCommand("Select * From DBO.RIMS_TEST_TABLE Where imageid=@ImagePDF_Name", myConnection);
 
SqlParameter imageIDParameter = new SqlParameter("@ImageId", SqlDbType.Int);
 
imageIDParameter.Value = imageid;
 
myCommand.Parameters.Add(imageIDParameter);
 
myConnection.Open();
 
 }
 
}


这篇关于我们如何检索SQL数据库中的pdf文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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