110,567
社区成员
发帖
与我相关
我的任务
分享
FileStream fs = new FileStream(StudentPhotoUpdatePath, FileMode.Open);
int len = (int)fs.Length;
byte[] fileData = new byte[len];
fs.Read(fileData, 0, len);
fs.Close();
OleDbConnection conn = new OleDbConnection(source);
string SQL = "update [" + TableName + "] set [" + ImageColName + "]=? where [" + WhereID + "]= ?";
OleDbCommand cmd = new OleDbCommand(SQL, conn);
cmd.Parameters.Add("?", OleDbType.Binary).Value = fileData;
cmd.Parameters.Add("?", OleDbType.VarChar).Value = IDValue;
conn.Open();
int countRow=cmd.ExecuteNonQuery();
conn.Close();