http://expert.csdn.net/Expert/topic/2493/2493940.xml?temp=.9298975,这个有,你也可以搜索图片,很多的

解决方案 »

  1.   

    ms-help://MS.NETFrameworkSDKv1.1.CHS/cpguidenf/html/cpconwritingblobvaluestodatabase.htm
      

  2.   

    look !
    SqlConnection cn = new SqlConnection(this.sqlstring);
    //int pub_id=2003;
    SqlCommand cmd =  new SqlCommand("INSERT INTO images (images_id, logo) VALUES (2003,@BLOBData)", cn);
    String strBLOBFilePath = @"C:/picture/bt1.jpg";//Modify this path as needed. //Read jpg into file stream, and from there into Byte array.
    FileStream fsBLOBFile =  new FileStream(strBLOBFilePath,FileMode.Open, FileAccess.Read);
    Byte[] bytBLOBData = new Byte[fsBLOBFile.Length]; 
    fsBLOBFile.Read(bytBLOBData, 0, bytBLOBData.Length);
    fsBLOBFile.Close(); //Create parameter for insert command and add to SqlCommand object.
    SqlParameter prm = new  SqlParameter("@BLOBData", SqlDbType.VarBinary, bytBLOBData.Length, ParameterDirection.Input, false, 
    0, 0, null, DataRowVersion.Current, bytBLOBData);
    cmd.Parameters.Add(prm); //Open connection, execute query, and close connection.
    cn.Open();
    cmd.ExecuteNonQuery();
    cn.Close();
      

  3.   

    to  smiletosky,烟鬼:
    谢谢你们的连接,我会看的。
    to乡村酒吧:
    Sqlserver2000
    to神农无忌:
    谢谢你的代码。我现在试一试。
    感谢各位关心,搞定马上揭帖!
      

  4.   

    to神农无忌:运行后数据库Img字段中显示“<Binary>”,对吗?
      

  5.   

    显示“<Binary>”是对的。
      

  6.   

    http://www.aspx.cn/article/go.asp?id=268&typeid=2
    http://www.aspx.cn/article/go.asp?id=267&typeid=2
    http://www.c-sharpcorner.com/Code/2002/Feb/FlashCardsMG.asp
    可以参考下
      

  7.   

    我其实目的是将一个字符串进行解析,客户输入html代码例如
    <IMG alt="" hspace=0 src="file:///C:/2.gif" align=baseline border=0>
    drtreyre5yreytertyry
    <IMG alt="" hspace=0 src="file:///C:/w.gif" align=baseline border=0>
    sdigoiodstgui
    <IMG alt="" hspace=0 src="file:///C:/w.gif" align=baseline border=0>
    dksgjkldgj将以上文件存到数据库,再浏览
    我是想将图片和文字分别存储。
      

  8.   

    运行后数据库Img字段中显示“<Binary>”,对吗?
    不管你有没有存入数据库,或者存入的完不完整,它都是显示为<Binary>。
    检查办法:看此字段大小(长短)。
    因忙,不常来:[email protected]