当前位置:首页
开发技术指南» 文章正文
    引言:
 

 

 ·宁静以致远。我明白了    »显示摘要«
    摘要: 宁静以致远。 为什么我们会有这么多烦恼 是因为我们要求欲望太多了。 看开点 顺气自然 ......
    摘要: up ......


读sql server 2000中的图片,显示在picturebox中,如何做(好多以前的贴子说的都不行)

读sql   server   2000中的图片,显示在picturebox中,如何做?(好多以前的贴子说的都不行)  
  代码如下:  
  string   sql;  
  sql   =     "Initial   Catalog=Northwind;Data   Source=localhost;Integrated   Security=SSPI;";  
  SqlConnection     conn   =   new   SqlConnection(sql);  
  conn.Open();  
  string   strCmd   =   String.Format("SELECT   photo   FROM   employees   WHERE   employeeid   =   {0}",1);  
  SqlCommand   cmd   =   new   SqlCommand(strCmd,   conn);  
  byte[]   b   =   (byte[])cmd.ExecuteScalar();  
  if   (   b.Length   >   0)  
  {  
  System.IO.MemoryStream   stream   =   new   System.IO.MemoryStream(b,   true);  
  stream.Write(b,   0,   b.Length);  
  Bitmap   bmp   =   new   Bitmap(stream);  
  if(   bmp.Width   >   500   ||   bmp.Height   >   300)  
  {  
  Bitmap   bmp1   =   new   Bitmap(bmp,   new   Size(500,300));  
  pictureBox1.Image   =   bmp1;  
  }  
  else  
  pictureBox1.Image   =   bmp;  
  stream.Close();  
  出错提示:使用了无效参数。  
  错误位置:Bitmap   bmp   =   new   Bitmap(stream);  
  何解?  
 

NO.1   作者: chinchy

http://www.codeproject.com/cs/database/albumviewer.asp


 ·asp里怎样使密码区分大小写    »显示摘要«
    摘要: 小弟做个注册页,但是asp和sql 7.0不区分大小写啊,哪位大虾知道的,帮个忙告诉我一声啊。 ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE