Excel 2003 cannot open Output file

Tech-Archive recommends: Fix windows errors by optimizing your registry



I created an ASP.net page which opens excel. This works fine in Office
2007. However, Excel 2003 runs in an error which states "cannot read
output file".

Hee is the VB code and below is the ASPX code.


Imports System.Data.SqlClient
Imports System.Web.Configuration
Imports System.Web.UI


Partial Class admin_excel
Inherits System.Web.UI.Page
Dim strconnectionString As String =
WebConfigurationManager.ConnectionStrings("LocalSqlServer").ConnectionString
Dim con As New SqlConnection(strconnectionString)
Dim cmd As New SqlCommand("", con)
Dim recordcount As String
Dim stringWrite As New System.IO.StringWriter
Dim htmlWrite As New System.Web.UI.HtmlTextWriter(stringWrite)
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load

If Not IsPostBack Then

Response.Clear()
Response.ContentType = "application/vnd.ms-excel"

Try
con.Open()

Dim myda As SqlDataAdapter
Dim ds As Data.DataSet
myda = New SqlDataAdapter("SELECT
gown_orders.StudentID,gown_studentinfo.FullName,gown_studentinfo.NRIC,gown_studentinfo.Gender
As Sex, gown_orders.GownSize As Size, gown_orders.Rental,
gown_orders.DeliveryOption As Delivery, gown_orders.HomeContact As
Contact, gown_orders.HPContact As Mobile,gown_orders.OrderDate,
gown_orders.IssueDate,gown_orders.Refunded, gown_studentinfo.School,
gown_studentinfo.Program, gown_studentinfo.GraduationSession FROM
gown_orders INNER JOIN gown_studentinfo ON gown_orders.StudentID =
gown_studentinfo.UserID", strconnectionString)
ds = New Data.DataSet
myda.Fill(ds, "AllTables")
GridViewOrderList.DataSource = ds.Tables(0)
GridViewOrderList.DataBind()
GridViewOrderList.RenderControl(htmlWrite)
Catch ex As Exception

con.Close()
Exit Try

Finally
con.Close()

End Try
End If


End Sub
End Class

============================================


Imports System.Data.SqlClient
Imports System.Web.Configuration
Imports System.Web.UI


Partial Class admin_excel
Inherits System.Web.UI.Page
Dim strconnectionString As String =
WebConfigurationManager.ConnectionStrings("LocalSqlServer").ConnectionString
Dim con As New SqlConnection(strconnectionString)
Dim cmd As New SqlCommand("", con)
Dim recordcount As String
Dim stringWrite As New System.IO.StringWriter
Dim htmlWrite As New System.Web.UI.HtmlTextWriter(stringWrite)
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load

If Not IsPostBack Then

Response.Clear()
Response.ContentType = "application/vnd.ms-excel"


Try
con.Open()

Dim myda As SqlDataAdapter
Dim ds As Data.DataSet
myda = New SqlDataAdapter("SELECT
gown_orders.StudentID,gown_studentinfo.FullName,gown_studentinfo.NRIC,gown_studentinfo.Gender
As Sex, gown_orders.GownSize As Size, gown_orders.Rental,
gown_orders.DeliveryOption As Delivery, gown_orders.HomeContact As
Contact, gown_orders.HPContact As Mobile,gown_orders.OrderDate,
gown_orders.IssueDate,gown_orders.Refunded, gown_studentinfo.School,
gown_studentinfo.Program, gown_studentinfo.GraduationSession FROM
gown_orders INNER JOIN gown_studentinfo ON gown_orders.StudentID =
gown_studentinfo.UserID", strconnectionString)
ds = New Data.DataSet
myda.Fill(ds, "AllTables")
GridViewOrderList.DataSource = ds.Tables(0)
GridViewOrderList.DataBind()
GridViewOrderList.RenderControl(htmlWrite)





Catch ex As Exception

con.Close()
Exit Try

Finally
con.Close()

End Try
End If


End Sub
End Class


===============================================

Any ideas why Excel 2003 cannot open the file?

Thanks

.



Relevant Pages

  • Re: Vb6 + Sql + Excel
    ... >> data into Excel using Jet provider, ... >>> Dim cString As String ... >>> Dim MerchantMonthly As String ... >>> Dim formatcell As String ...
    (microsoft.public.vb.database.ado)
  • Re: How can I programmatically relink OLEs in a Word document?
    ... Excel sheets have 196 different tabs. ... Sub ChangeSource() ... 'Create a variable to store the object reference string. ... Dim s As Shape ...
    (microsoft.public.word.vba.general)
  • EMail Outlook failing
    ... I moved the Excel files to the root drive in a sub folder and added ... "Excel cannot complete this task with available resources. ... Dim FileFormatNum As Long ... Dim TempFilePath As String ...
    (microsoft.public.excel.programming)
  • Re: EMail Outlook failing
    ... "Excel cannot complete this task with available resources. ... Dim FileFormatNum As Long ... Dim TempFilePath As String ...
    (microsoft.public.excel.programming)
  • Re: Performance beim Löschen von Zeilen (Excel XP)
    ... Also muss sich in Excel 2002 irgendwas ... String und nicht auf Long, ... Public Sub DeleteRows(WorkbookName As String, ... Dim lsRange As String ...
    (microsoft.public.de.excel)