本文介绍了PDF文件使用asp.net从DataBase检索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 string SQL = SELECT * FROM DPSpdf WHERE intpdfId =' + txtdanceid.Text + '; SqlCommand myCommand = new SqlCommand(SQL,(SqlConnection)Application.Get( DPS)); myCommand.Parameters.AddWithValue( @ intpdfId,txtdanceid.Text); SqlDataReader myReader = myCommand.ExecuteReader(); if (myReader.Read()) { Response.ContentType = myReader [ ContentType]。ToString(); Response.BinaryWrite(( byte [])myReader [ strpdfurl]); } myReader.Close(); Response.End(); 我哪里错了?解决方案 string SQL = "SELECT * FROM DPSpdf WHERE intpdfId='" + txtdanceid.Text + "'"; SqlCommand myCommand = new SqlCommand(SQL, (SqlConnection)Application.Get("DPS")); myCommand.Parameters.AddWithValue("@intpdfId", txtdanceid.Text); SqlDataReader myReader = myCommand.ExecuteReader(); if (myReader.Read()) { Response.ContentType = myReader["ContentType"].ToString(); Response.BinaryWrite((byte[])myReader["strpdfurl"]); } myReader.Close(); Response.End();Where i did mistake? 解决方案 这篇关于PDF文件使用asp.net从DataBase检索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-30 06:44