C#是否可以通过DataTable实现Oracle与Excle交互
来源:百度知道 编辑:UC知道 时间:2024/05/07 02:38:27
可以的, 规则的EXCEL,就是文件型的数据库
操作,可以参考:
http://www.zu14.cn/tag/oledbhelper/
定义连接对象时使用OracleConnection不就行了么?
比如我们常写的是 SqlConnection conn=new SqlConnection();
这里改成OracleConnection conn=new OracleConnection ();
至于导入到Excel,写个方法就行了,相信应该不是问题了吧?网上随便搜一大把
当然可以了,Oracle与Excle都是数据库。和别得数据库一样得么
一下是实现该功能的例子:
该例子是将从ORACLE中取得是数据放在dataset中,并实现导出成EXCEL的功能
public static void Convert(DataSet ds, HttpResponse response)
{
response.Clear();
response.Buffer = true;
response.Charset = "utf-8";
response.ContentEncoding = System.Text.Encoding.Default;
response.AddHeader("Content-Disposition", "attachment;filename=Report.xls");
response.Cache.SetCacheability(HttpCacheability.NoCache);
response.ContentType = &qu