//得到提交的文件
Stream stream = MyFile.PostedFile.InputStream;
//得到文件的大小
int length = MyFile.PostedFile.ContentLength;
//创建数组
byte[] file = new byte[length];
//把文件流填入数组
stream.Read(file, 0, length);
//得到文件类型
string fileType = MyFile.PostedFile.ContentType;
//创建参数
OleDbCommand cmd = new OleDbCommand("INSERT INTO Person(Name, Email, Sex)" + "VALUES(@Name, @Email, @Sex)", con);
OleDbParameter paramName = new OleDbParameter("@Name", OleDbType.VarChar, 50);
paramName.Value = name;
cmd.Parameters.Add(paramName);
Stream stream = MyFile.PostedFile.InputStream;
//得到文件的大小
int length = MyFile.PostedFile.ContentLength;
//创建数组
byte[] file = new byte[length];
//把文件流填入数组
stream.Read(file, 0, length);
//得到文件类型
string fileType = MyFile.PostedFile.ContentType;
//创建参数
OleDbCommand cmd = new OleDbCommand("INSERT INTO Person(Name, Email, Sex)" + "VALUES(@Name, @Email, @Sex)", con);
OleDbParameter paramName = new OleDbParameter("@Name", OleDbType.VarChar, 50);
paramName.Value = name;
cmd.Parameters.Add(paramName);