| 发表于:2007-04-11 19:19:248楼 得分:20 |
string clientpath = this.fileupload2.filename; byte[] filedata = this.fileupload2.filebytes; string sql = "insert into t_img(img) values (@img) "; string strconn = system.configuration.configurationmanager.connectionstrings[ "fengdongdb "].tostring(); sqlconnection conn = new sqlconnection(strconn); sqlcommand comm = new sqlcommand(sql, conn); comm.parameters.add( "@img ", sqldbtype.image); comm.parameters[ "@img "].value = filedata; conn.open(); comm.EXECutenonquery(); conn.close(); 上面的代码实现了在asp.net2.0中把客户端上传的文件保存到sqlserver的image字段中 | | |
|