TextBox1过来的代码:
protected void Button1_Click(object sender, EventArgs e)
{
string connString = ConfigurationManager.ConnectionStrings["EDSS"].ConnectionString;
int ID = Convert.ToInt32(TextBox1.Text );
SqlConnection connection = new SqlConnection(connString); string sql = "SELECT Photo FROM DeviceInfo WHERE ID = "+ @ID ; SqlCommand command = new SqlCommand(sql, connection);
command.Parameters.Add(new SqlParameter("@ID", 4));
connection.Open(); Stream stream = null;
object result = command.ExecuteScalar();
stream = new MemoryStream((byte[])result);
const int buffersize = 1024 * 16;
byte[] buffer = new byte[buffersize];
int count = stream.Read(buffer, 0, buffersize);
while (count > 0)
{
Response.OutputStream.Write(buffer, 0, count);
count = stream.Read(buffer, 0, buffersize);
}
}request过来的代码:
protected void Button1_Click(object sender, EventArgs e)
{
string connString = ConfigurationManager.ConnectionStrings["EDSS"].ConnectionString;
int ID= Convert.ToInt32(Request.QueryString["ID"]);
SqlConnection connection = new SqlConnection(connString); string sql = "SELECT Photo FROM DeviceInfo WHERE ID = "+ @ID ; SqlCommand command = new SqlCommand(sql, connection);
command.Parameters.Add(new SqlParameter("@ID", 4));
connection.Open(); Stream stream = null;
object result = command.ExecuteScalar();
stream = new MemoryStream((byte[])result);
const int buffersize = 1024 * 16;
byte[] buffer = new byte[buffersize];
int count = stream.Read(buffer, 0, buffersize);
while (count > 0)
{
Response.OutputStream.Write(buffer, 0, count);
count = stream.Read(buffer, 0, buffersize);
}
}奇怪的是并不报错 只是没有显示
protected void Button1_Click(object sender, EventArgs e)
{
string connString = ConfigurationManager.ConnectionStrings["EDSS"].ConnectionString;
int ID = Convert.ToInt32(TextBox1.Text );
SqlConnection connection = new SqlConnection(connString); string sql = "SELECT Photo FROM DeviceInfo WHERE ID = "+ @ID ; SqlCommand command = new SqlCommand(sql, connection);
command.Parameters.Add(new SqlParameter("@ID", 4));
connection.Open(); Stream stream = null;
object result = command.ExecuteScalar();
stream = new MemoryStream((byte[])result);
const int buffersize = 1024 * 16;
byte[] buffer = new byte[buffersize];
int count = stream.Read(buffer, 0, buffersize);
while (count > 0)
{
Response.OutputStream.Write(buffer, 0, count);
count = stream.Read(buffer, 0, buffersize);
}
}request过来的代码:
protected void Button1_Click(object sender, EventArgs e)
{
string connString = ConfigurationManager.ConnectionStrings["EDSS"].ConnectionString;
int ID= Convert.ToInt32(Request.QueryString["ID"]);
SqlConnection connection = new SqlConnection(connString); string sql = "SELECT Photo FROM DeviceInfo WHERE ID = "+ @ID ; SqlCommand command = new SqlCommand(sql, connection);
command.Parameters.Add(new SqlParameter("@ID", 4));
connection.Open(); Stream stream = null;
object result = command.ExecuteScalar();
stream = new MemoryStream((byte[])result);
const int buffersize = 1024 * 16;
byte[] buffer = new byte[buffersize];
int count = stream.Read(buffer, 0, buffersize);
while (count > 0)
{
Response.OutputStream.Write(buffer, 0, count);
count = stream.Read(buffer, 0, buffersize);
}
}奇怪的是并不报错 只是没有显示
解决方案 »
- 微妙的问题,赶集进了!
- 谁做过这个导航栏的例子
- 一个觉得简单 但困扰我的绑定问题
- 为什么VS2008没有数据集的视图?
- 请教高手如何获取DataGrid摸版列中label控件的TEXT属性值!
- 请教一个关于DataGrid中Checkbox的问题
- dropdownlist中第一条条目中显示内容为 -请选择分类- 应该如何实现
- 任意四个数字(1---10),加减乘除最后结果为24的算法!
- 帮忙写一条sql语句吧
- 请问:asp.net远程连vf6数据库用odbc,连上后,da.Fill(ds,"abc")时为什么总提示找不到相应的table(散分100)
- 问一个WEB开发问题
- form认证,能不能有两个登录页面?
最好先判断if(null ==Request.QueryString["ID"])
显示图片 Response.OutputStream.Write(buffer, 0, count);
用这个显示to vzxq(灵感人)
加上断点了 不是空值 但就是没有自己要的结果