社区
C#
帖子详情
通过C#将SqlServer中存储过程查询出的结果到出到Excel???
gpz_dalian
2007-01-15 02:10:13
通过C#编写代码
调用SqlServer中存储过程
将查询出的结果到出到Excel!
应该如何写代码
请高手指点一下?
多谢了!!!
...全文
315
8
打赏
收藏
通过C#将SqlServer中存储过程查询出的结果到出到Excel???
通过C#编写代码 调用SqlServer中存储过程 将查询出的结果到出到Excel! 应该如何写代码 请高手指点一下? 多谢了!!!
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
8 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
yyoyidl
2007-12-28
打赏
举报
回复
Response.Clear();
Response.Buffer= true;
Response.Charset= "GB2312 ";
Response.AppendHeader( "Content-Disposition ", "attachment;filename=boyd_Reporter.xls ");
Response.ContentEncoding=System.Text.Encoding.GetEncoding( "GB2312 ");//设置输出流为简体中文
Response.ContentType = "application/ms-excel ";//设置输出文件类型为excel文件。
this.EnableViewState = false;
System.Globalization.CultureInfo myCItrad = new System.Globalization.CultureInfo( "ZH-CN ",true);
System.IO.StringWriter oStringWriter=new System.IO.StringWriter(myCItrad);
System.Web.UI.HtmlTextWriter oHtmlTextWriter=new System.Web.UI.HtmlTextWriter(oStringWriter);
this.Boyd_Dg1.Font.Size=10; //设置输出报表文字大小为10号,偏小
this.Boyd_Dg1.BorderStyle=System.Web.UI.WebControls.BorderStyle.Double;
this.Boyd_Dg1.BorderColor=Color.Black;
this.Boyd_Dg1.RenderControl(oHtmlTextWriter);
Response.Write(oStringWriter.ToString());
Response.End();
gangzichh
2007-04-29
打赏
举报
回复
mark
honkerhero
2007-01-15
打赏
举报
回复
据说第一个给的方法较快,第二个次之
bitpolar
2007-01-15
打赏
举报
回复
学习
竹林听雨2005
2007-01-15
打赏
举报
回复
绑定数据的不要我再搞定了吧?
竹林听雨2005
2007-01-15
打赏
举报
回复
//要求:有datagrid控件,Boyd_Dg1,将数据先绑定至Boyd_Dg1即可,
Response.Clear();
Response.Buffer= true;
Response.Charset="GB2312";
Response.AppendHeader("Content-Disposition","attachment;filename=boyd_Reporter.xls");
Response.ContentEncoding=System.Text.Encoding.GetEncoding("GB2312");//设置输出流为简体中文
Response.ContentType = "application/ms-excel";//设置输出文件类型为excel文件。
this.EnableViewState = false;
System.Globalization.CultureInfo myCItrad = new System.Globalization.CultureInfo("ZH-CN",true);
System.IO.StringWriter oStringWriter=new System.IO.StringWriter(myCItrad);
System.Web.UI.HtmlTextWriter oHtmlTextWriter=new System.Web.UI.HtmlTextWriter(oStringWriter);
this.Boyd_Dg1.Font.Size=10; //设置输出报表文字大小为10号,偏小
this.Boyd_Dg1.BorderStyle=System.Web.UI.WebControls.BorderStyle.Double;
this.Boyd_Dg1.BorderColor=Color.Black;
this.Boyd_Dg1.RenderControl(oHtmlTextWriter);
Response.Write(oStringWriter.ToString());
Response.End();
glacier111
2007-01-15
打赏
举报
回复
public static void GenerateByHtmlString(string Typename, string TempHtml)
{
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.Buffer = true;
HttpContext.Current.Response.Charset = "utf-8";
string Filename = Typename + ".xls";
HttpContext.Current.Response.AppendHeader("Content-Disposition", "online;filename=" + Filename);
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
HttpContext.Current.Response.ContentType = "application/ms-excel";
//this.EnableViewState = false;
HttpContext.Current.Response.Write(TempHtml);
HttpContext.Current.Response.End();
}
Typename 文件名
TempHtml 将数据配置成HTML字符串放到这个字符串里
C#
通过
存储过程
将
Excel
文档导入SQL Server数据库
以
Excel
表格形式导入到数据库,为此写了一个这样一个测试程序,当然,里面导入的
Excel
表格的字段、表名都可以自定义的,过程比较简单,主要用到了Sql Server和
Excel
的接口类库
Excel
导入
SQLserver
源码
Excel
导入
SQLserver
源码
Excel
是一种非常灵活的电子表格软件,用它可以存储各种数据,本节将对如何将
Excel
导入SQL Server2000数据库进行详细介绍。 开发环境:NET2.0 开发工具:vs2005 开发语言:
c#
数据库:server...
导
出
表结构到
Excel
导
出
存储过程
、序列、函数脚本(
sqlserver
、mysql) Demo下载
本资源对应个人的博文“导
出
表结构到
Excel
导
出
存储过程
、序列、函数脚本(
sqlserver
、mysql)”下载资源 博文链接 https://blog.csdn.net/wanghuiWHI/article/details/90288609
酒店管理系统(
sqlserver
2008
C#
)
终极智力备份(我自己做的专利数据池功能,可以将sql
中
数据,多
EXcel
数据,临时自定义数据合并一块,并可导入到数据库,导
出
到
Excel
文件,智能检查数据))),客人入住登记,客人登记信息根据时间段,结账状态
查询
,...
c#
读取
excel
导入到数据库
读取
excel
表,导入到数据库
中
然后更新正式库 把DBhelper里的链接修改了。。 建立好test 和test_1注释掉那个2个存储过称就就应该能用了 CREATE TABLE [dbo].[test]( [日期] [datetime] NULL, [车号] [nvarchar]...
C#
110,545
社区成员
642,580
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章