Web程序中将Cell华表的修改 保存到数据库或服务器端文件夹内
2007-09-11 10:53
393 查看
1.JS端 调用UploadFile方法
2.处理页面的相关编码
=========================
1.
----------------
//JS端 调用UploadFile方法
//该方法可能部分低版本不支持
var flag1 = cellShow.UploadFile("ReportUpload.aspx?
ReportType=1&CellType=1&CellTitle="+escape(FiledTitle)+
"&CellModule="+escape(cellModule)+"");
2.
----------------
//ReportUpload.aspx页面的相关代码
//该页面为空页面
//只需要Page_Load内如下相关操作就可
using ...
using System.IO;
protected void Page_Load(object sender, System.EventArgs e)
{
// 接收客户发来的文件流
int nBytes = Request.TotalBytes;
byte[] UpFile = new byte[nBytes];
UpFile = Request.BinaryRead(nBytes);
// 保存到CellReport数据库中
string myConnString = "Provider=Microsoft.Jet.OLEDB.4.0;data source =";
OleDbConnection myConn =
new OleDbConnection( myConnString + Server.MapPath("CellReport.mdb"));
myConn.Open();
string sql = "SELECT * FROM CellReportUpload";
OleDbDataAdapter myAdapter = new OleDbDataAdapter(sql, myConn);
OleDbCommandBuilder oleDbCommandBuilder = new OleDbCommandBuilder(myAdapter);
DataSet ds = new DataSet();
myAdapter.Fill(ds, "CellReportUpload");
DataRow dr = ds.Tables["CellReportUpload"].NewRow();
dr[1] = UpFile;
ds.Tables["CellReportUpload"].Rows.Add(dr);
myAdapter.Update(ds, "CellReportUpload");
ds.Tables["CellReportUpload"].AcceptChanges();
myConn.Close();
// 保存到磁盘文件,通过流将数据保存成文件
string strCellTitle = Request.QueryString["CellTitle"];
string strCellModule = Request.QueryString["CellModule"];
string strCellPath = "rpt" + strCellModule + "/where_" + strCellTitle + ".cll";
if (File.Exists(Server.MapPath(strCellPath)))
File.Delete(Server.MapPath(strCellPath));
Stream fStream = new FileStream(Server.MapPath(strCellPath), FileMode.Create);
fStream.Write(UpFile, 0, nBytes);
fStream.Close();
}
2.处理页面的相关编码
=========================
1.
----------------
//JS端 调用UploadFile方法
//该方法可能部分低版本不支持
var flag1 = cellShow.UploadFile("ReportUpload.aspx?
ReportType=1&CellType=1&CellTitle="+escape(FiledTitle)+
"&CellModule="+escape(cellModule)+"");
2.
----------------
//ReportUpload.aspx页面的相关代码
//该页面为空页面
//只需要Page_Load内如下相关操作就可
using ...
using System.IO;
protected void Page_Load(object sender, System.EventArgs e)
{
// 接收客户发来的文件流
int nBytes = Request.TotalBytes;
byte[] UpFile = new byte[nBytes];
UpFile = Request.BinaryRead(nBytes);
// 保存到CellReport数据库中
string myConnString = "Provider=Microsoft.Jet.OLEDB.4.0;data source =";
OleDbConnection myConn =
new OleDbConnection( myConnString + Server.MapPath("CellReport.mdb"));
myConn.Open();
string sql = "SELECT * FROM CellReportUpload";
OleDbDataAdapter myAdapter = new OleDbDataAdapter(sql, myConn);
OleDbCommandBuilder oleDbCommandBuilder = new OleDbCommandBuilder(myAdapter);
DataSet ds = new DataSet();
myAdapter.Fill(ds, "CellReportUpload");
DataRow dr = ds.Tables["CellReportUpload"].NewRow();
dr[1] = UpFile;
ds.Tables["CellReportUpload"].Rows.Add(dr);
myAdapter.Update(ds, "CellReportUpload");
ds.Tables["CellReportUpload"].AcceptChanges();
myConn.Close();
// 保存到磁盘文件,通过流将数据保存成文件
string strCellTitle = Request.QueryString["CellTitle"];
string strCellModule = Request.QueryString["CellModule"];
string strCellPath = "rpt" + strCellModule + "/where_" + strCellTitle + ".cll";
if (File.Exists(Server.MapPath(strCellPath)))
File.Delete(Server.MapPath(strCellPath));
Stream fStream = new FileStream(Server.MapPath(strCellPath), FileMode.Create);
fStream.Write(UpFile, 0, nBytes);
fStream.Close();
}
相关文章推荐
- Web程序中将Cell华表的修改 保存到数据库或服务器端文件夹内
- web项目中将上传的文件保存到服务器的某个文件夹,保证clean tomcat时不会被清理掉
- 安装程序类(VB.net,新建数据库,修改webconfig文件)
- va web程序起动时从数据库读入数据保存至程序全局变量
- 可以在mono下运行的一个ajax web小程序,使用PostgreSQL作为数据库(期待MonoDevelop 2.0)
- 做了表分区以后的数据库表,在使用程序进行修改操作时报异常。
- Java遍历文件夹下所有文件,并且将数据保存在数据库当中
- Web 平台安装程序 5.0(Microsoft Web Platform Installer) 由于修改常用选择不正确导致打开就报错
- SQL SERVER 2008数据库表中修改字段后不能保存
- java小程序从数据库中(表)中读取数据然后创建文件夹生成txt文件
- 帆软FineReport_单sheet填报,多sheet填报,点击按钮保存全部(数据库修改功能)
- 又做了一个小程序,修改文件夹图标。
- 直接修改Datagridview并保存到数据库
- web.Config保存数据库连接字符串
- 修改web.config文件的数据库连接字…
- [问]VS2005,C#winform程序,代码修改app.config的结果保存到哪里了?
- windows form中将服务器端的文件保存到客户端
- 用Delphi开发Web服务数据库程序
- virtualbox中ubuntu和windows共享文件夹设置,包括自动挂载,修改编辑保存/etc/fstab文件详细过程
- 修改LoadRunner自带示例程序WebTours的端口