@类的问题
public void SaveImage(string MID, OpenFileDialog openF)
{
string P_str = openF.FileName;//得到图片的所在路径
FileStream fs = new FileStream(//创建文件流对象
P_str, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fs);//创建二进制读取器
byte[] imgBytesIn = br.ReadBytes((int)fs.Length);//将流读入到字节数组中
conn.Open();//打开数据库连接
StringBuilder strSql = new StringBuilder();//创建字符串构造器
strSql.Append(//附加字符串
"update tb_employee Set employeePhoto=@Photo where employeeID=" + MID);
SqlCommand cmd = new SqlCommand(strSql.ToString(), conn);//创建命令对象
cmd.Parameters.Add("@Photo", SqlDbType.Binary).Value = imgBytesIn;//添加参数
cmd.ExecuteNonQuery();//执行SQL命令
conn.Close();//关闭数据库连接
两次出现@Photo",不知道@是啥意思,我只知道@第一种意思,这里面的意思真的不知道。主高手指教下。
}