SqlConnection mycon = new SqlConnection("conString")
SqlCommand mycmd = mycon.CreateCommand();
= CommandType.StoredProcedure;
= "StoredProcedureName";
SqlParameter para14 = new SqlParameter();
para14.ParameterName = "@picimg";
para14.SqlDbType = SqlDbType.Image;
string filename = openFileDialog1.FileName;
//从文件中读数据
FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read);
//建立一个2进制数组
byte[] mydata = new byte[fs.Length];
fs.Read(mydata, 0, (int)fs.Length);
fs.Close();
para14.Value = mydata;
mycmd.Parameters.Add(para14);
mycmd.ExecuteNonQuery();
[[it] 本帖最后由 zouzhou1984 于 2008-4-13 22:43 编辑 [/it]]
SqlCommand mycmd = mycon.CreateCommand();
= CommandType.StoredProcedure;
= "StoredProcedureName";
SqlParameter para14 = new SqlParameter();
para14.ParameterName = "@picimg";
para14.SqlDbType = SqlDbType.Image;
string filename = openFileDialog1.FileName;
//从文件中读数据
FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read);
//建立一个2进制数组
byte[] mydata = new byte[fs.Length];
fs.Read(mydata, 0, (int)fs.Length);
fs.Close();
para14.Value = mydata;
mycmd.Parameters.Add(para14);
mycmd.ExecuteNonQuery();
[[it] 本帖最后由 zouzhou1984 于 2008-4-13 22:43 编辑 [/it]]