怎样在webform窗口中显示数据库中二进制(图片)字段? 还问一个问题在webform窗口加入textbox控件,怎样将数据集的一个字段捆绑到textbox控件中去?好像在winform中可以。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 第一个问题http://www.dotnetbips.com/displayarticle.aspx?id=101 下面是我的一段代码,数据库是mssql自带的{string imgid =Request.QueryString["no"]; string connstr="data source=leebons;initial catalog=Northwind;integrated security=SSPI;persist security info=False;workstation id=LEEBONS;packet size=4096"; string sql="SELECT Description,Picture FROM Categories where CategoryID="+imgid; SqlConnection connection = new SqlConnection(connstr); SqlCommand command = new SqlCommand(sql, connection); connection.Open(); SqlDataReader dr = command.ExecuteReader(); if(dr.Read()) { // FileStream fs = new FileStream("C:\\temp.jpg", FileMode.Create); //fs.Write((byte[]) dr["Picture"],0,((byte[]) dr["Picture"]).Length); //fs.Close(); //Response.ContentType = dr["Picture"].GetType().ToString(); Response.BinaryWrite( ((byte[])dr["Picture"]) );}可是我看见怎么是乱码啊?请问这是怎么回事? 顶,我也遇到这类问题,而且下载的时候弹出的是下载aspx文件的对话框?! Response.ContentType = ImageType;// Write data out of database into Output StreamResponse.OutputStream.Write((byte[])Image, 0, ImageLength); http://www.yesky.com/20030311/1656281.shtml 下面是我的一段代码,数据库是mssql自带的{string imgid =Request.QueryString["no"]; string connstr="data source=leebons;initial catalog=Northwind;integrated security=SSPI;persist security info=False;workstation id=LEEBONS;packet size=4096"; string sql="SELECT Description,Picture FROM Categories where CategoryID="+imgid; SqlConnection connection = new SqlConnection(connstr); SqlCommand command = new SqlCommand(sql, connection); connection.Open(); SqlDataReader dr = command.ExecuteReader(); if(dr.Read()) { // FileStream fs = new FileStream("C:\\temp.jpg", FileMode.Create); //fs.Write((byte[]) dr["Picture"],0,((byte[]) dr["Picture"]).Length); //fs.Close(); //Response.ContentType = dr["Picture"].GetType().ToString(); Response.BinaryWrite( ((byte[])dr["Picture"]) );}可是我看见怎么是乱码啊?请问这是怎么回事?请帮我修改这段代码!! 下面是我的一段代码,数据库是mssql自带的{string imgid =Request.QueryString["no"]; string connstr="data source=leebons;initial catalog=Northwind;integrated security=SSPI;persist security info=False;workstation id=LEEBONS;packet size=4096"; string sql="SELECT Description,Picture FROM Categories where CategoryID="+imgid; SqlConnection connection = new SqlConnection(connstr); SqlCommand command = new SqlCommand(sql, connection); connection.Open(); SqlDataReader dr = command.ExecuteReader(); if(dr.Read()) { Response.BinaryWrite( ((byte[])dr["Picture"]) );}可是我看见怎么是乱码啊?请问这是怎么回事?请帮我修改这段代码!! 你把这段代码放在哪里了,是应用程序中,还是放在ASP.NET中? 当然在ASP.NET中,这段代码写在page的load事件中。请帮我修正 关于一个统计周的算法问题 URL重写 地址匹配问题 不錯的c# 关于treeview的问题 请教如何控制使用指定的网卡通信! 救命啊,硬盘故障~~~~~开机后,可以显示找到硬盘,但却无法加载它。 各位大虾,我从没用过水晶报表,有几个Cai问题请教 指教菜鸟哈,委托全写在一个窗体里还是委托么,下面代码写在一个窗体里,算委托么 [求助] C# 操作WORD, 在WORD的书签中插入表格问题? 如何传递窗体控件或对象? 打包打包~~~~~什么是打包?? c#请求援助
http://www.dotnetbips.com/displayarticle.aspx?id=101
{string imgid =Request.QueryString["no"]; string connstr="data source=leebons;initial catalog=Northwind;integrated security=SSPI;persist security info=False;workstation id=LEEBONS;packet size=4096"; string sql="SELECT Description,Picture FROM Categories where CategoryID="+imgid; SqlConnection connection = new SqlConnection(connstr); SqlCommand command = new SqlCommand(sql, connection); connection.Open(); SqlDataReader dr = command.ExecuteReader(); if(dr.Read()) {
// FileStream fs = new FileStream("C:\\temp.jpg", FileMode.Create);
//fs.Write((byte[]) dr["Picture"],0,((byte[]) dr["Picture"]).Length);
//fs.Close();
//Response.ContentType = dr["Picture"].GetType().ToString(); Response.BinaryWrite( ((byte[])dr["Picture"]) );
}
可是我看见怎么是乱码啊?请问这是怎么回事?
Response.OutputStream.Write((byte[])Image, 0, ImageLength);
{string imgid =Request.QueryString["no"]; string connstr="data source=leebons;initial catalog=Northwind;integrated security=SSPI;persist security info=False;workstation id=LEEBONS;packet size=4096"; string sql="SELECT Description,Picture FROM Categories where CategoryID="+imgid; SqlConnection connection = new SqlConnection(connstr); SqlCommand command = new SqlCommand(sql, connection); connection.Open(); SqlDataReader dr = command.ExecuteReader(); if(dr.Read()) {
// FileStream fs = new FileStream("C:\\temp.jpg", FileMode.Create);
//fs.Write((byte[]) dr["Picture"],0,((byte[]) dr["Picture"]).Length);
//fs.Close();
//Response.ContentType = dr["Picture"].GetType().ToString(); Response.BinaryWrite( ((byte[])dr["Picture"]) );
}
可是我看见怎么是乱码啊?请问这是怎么回事?请帮我修改这段代码!!
{string imgid =Request.QueryString["no"]; string connstr="data source=leebons;initial catalog=Northwind;integrated security=SSPI;persist security info=False;workstation id=LEEBONS;packet size=4096"; string sql="SELECT Description,Picture FROM Categories where CategoryID="+imgid; SqlConnection connection = new SqlConnection(connstr); SqlCommand command = new SqlCommand(sql, connection); connection.Open(); SqlDataReader dr = command.ExecuteReader(); if(dr.Read()) { Response.BinaryWrite( ((byte[])dr["Picture"]) );
}
可是我看见怎么是乱码啊?请问这是怎么回事?请帮我修改这段代码!!
请帮我修正