http://www.csdn.net/expert/topic/651/651112.xml?temp=.8826715

解决方案 »

  1.   

    System.IO.FileStream fs = new System.IO.FileStream("file path and name", IO.FileMode.Open, IO.FileAccess.Read);
    byte[] imgData = new byte[fs.Length];
    fs.Read(imgData, 0, fs.Length);
    SqlConnection conn = new SqlConnection("...");
    SqlDataAdapter da = new SqlDataAdapter("select ... ", conn);
    DataSet ds = new DataSet();
    da.Fill(ds);
    SqlCommandBuilder cb = new SqlCommandBuilder(da);
    ds.Tables[0].Rows[0]["img"] = imgData;
    da.Update(ds);
    其中,img字段为Image类型。