strFileName = (this.FileUpload1.PostedFile.FileName).ToLower();//取文件名
intDocLen = this.FileUpload1.PostedFile.ContentLength;//文件长度
byte[] Docbuffer = new byte[intDocLen];
objStream = this.FileUpload1.PostedFile.InputStream;
objStream.Read(Docbuffer, 0, intDocLen);
MSSQLHelper.adConnectionOpen(this.adConn);
string sqlstr;
try
{
sqlstr = "insert into tsys_Download(Title,[Description],Content,[FileName],TypeID,RegDate,RegUser,IsShow) values('" + strTitle + "','" + strdesc + "',@content,'" + strFileName + "','" + strTypeID + "','" + strDate + "','" + strUser + "'," + bIsShow + ")";
System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand(sqlstr, this.adConn);
= sqlstr;
cmd.Parameters.Add("@content", System.Data.SqlDbType.Image);// 入库的类型
cmd.Parameters["@content"].Value = Docbuffer;// 将数据流转换为字节数组
cmd.ExecuteNonQuery();
}
catch (System.Exception ex)
{
Auda.Web.Utility.MSSQLHelper.adConnectionClose(this.adConn);
}