0
我正在同时将数据导出到Excel工作表异常数据导出到Excel
ERROR:
Message :
Exception of type 'System.Web.HttpUnhandledException' was thrown.
Error Description :
System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
有人建议我什么我必须做以下错误,当到来。
CODE:
gridData.dataSource = GetData()
gridData.DataBind()
Response.Clear()
Response.AddHeader("content-disposition", "attachment;filename=CompletionDatesReport.xls")
Response.Charset = ""
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.ContentType = "application/vnd.xls"
Dim stringWrite As StringWriter = New StringWriter()
Dim htmlWrite As HtmlTextWriter = New HtmlTextWriter(stringWrite)
gridData.RenderControl(htmlWrite)
Response.Write(stringWrite.ToString())
Response.End()
抛出的异常是** sql **异常;你添加的代码告诉我们在编辑中仍然没有告诉我们你的数据库访问。我们所知道的只是`gridData`被介入到某个地方。 – 2010-12-01 06:17:16
在我的代码我将记录绑定到DataGrid,然后将数据导出到excel sheet.In使用存储过程的GetData()函数我从数据库中获取数据。当我在查询分析器中运行存储过程它的确定,但在我的代码给出错误即将到来。 – Sukhjeevan 2010-12-01 06:33:58