求C# 取SQLSERVER 中图像程序! http://search.csdn.net/Expert/topic/1102/1102789.xml?temp=.5734674 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 using System.Data;using System.Data.SqlClient;using System.IO;using System;//读取二进制流public class ReadByte{ public static void Main(string[] args) { const string constr = "workstation id=NBPC;packet size=4096;integrated security=sspi;initial catalog=Northwind;persist security info=False"; SqlConnection con = new SqlConnection(constr); const string cmdstr = "Select pub_id,pr_info,logo From pub_info where pub_id = '0736'"; SqlCommand cmd = new SqlCommand(cmdstr,con); con.Open(); SqlDataReader byteRead = cmd.ExecuteReader(); //声明内存流 MemoryStream stream = new MemoryStream(); //二进制流 BinaryWriter writer = new BinaryWriter(stream); //参数 int BufferSize = 1024; byte[] Buffer = new byte[BufferSize]; long Offset =0; long BytesRead =0; //使用方法见(.NET学习笔记) do { BytesRead = byteRead.GetBytes(2,Offset,Buffer,0,BufferSize); writer.Write(Buffer,0,(int)BytesRead); writer.Flush(); Offset += BytesRead; }while(BytesRead==BufferSize); //读取到末尾退出 }}参照以上的程序 改成WinForm的 生成Image对象 并赋给PictureBox的image属性 我的程序:请高手帮忙分析一下!!string sql="select image1 from 表 where id=18";DataSet ds =QuerySqlDataSet(sql);MemoryStream stream = new MemoryStream((byte[])ds.Tables[0].Rows[0][0]);Image image = Image.FromStream(stream); this.pictureBox1.Image=image; 怎样提高一个类引用另外一个类的属性的效率 C# listview跪求实现方法.求包养! 如何把DNS转成IP地址? 抽取网页内容的算法 C# 请教,如何何datagrid中的某些列,只有在新增行时,才可以编辑 存储过程的问题,急救!!!关注有分!!! c#的数据库连接字符串怎么写? 【在线等】!~!~!~ 两行超级简单的代码让你的程序直接崩溃,请指出原因! Microsoft Enterprise Library 有什么用? 200分求:怎么使listview的滑动条移动让某listviewitem到上面来,免的被遮住了? 关于Cookie的问题,难以理解,请高手来解答。
using System.Data.SqlClient;
using System.IO;
using System;
//读取二进制流
public class ReadByte
{
public static void Main(string[] args)
{
const string constr = "workstation id=NBPC;packet size=4096;integrated security=sspi;initial catalog=Northwind;persist security info=False";
SqlConnection con = new SqlConnection(constr);
const string cmdstr = "Select pub_id,pr_info,logo From pub_info where pub_id = '0736'";
SqlCommand cmd = new SqlCommand(cmdstr,con);
con.Open();
SqlDataReader byteRead = cmd.ExecuteReader();
//声明内存流
MemoryStream stream = new MemoryStream();
//二进制流
BinaryWriter writer = new BinaryWriter(stream);
//参数
int BufferSize = 1024;
byte[] Buffer = new byte[BufferSize];
long Offset =0;
long BytesRead =0;
//使用方法见(.NET学习笔记)
do
{
BytesRead = byteRead.GetBytes(2,Offset,Buffer,0,BufferSize);
writer.Write(Buffer,0,(int)BytesRead);
writer.Flush();
Offset += BytesRead;
}while(BytesRead==BufferSize); //读取到末尾退出
}}参照以上的程序 改成WinForm的 生成Image对象 并赋给PictureBox的image属性
请高手帮忙分析一下!!string sql="select image1 from 表 where id=18";
DataSet ds =QuerySqlDataSet(sql);
MemoryStream stream = new MemoryStream((byte[])ds.Tables[0].Rows[0][0]);
Image image = Image.FromStream(stream);
this.pictureBox1.Image=image;