FUNCTION NOT WORKING ON SERVER MACHINE.

I had matured a VB.Net Function to goods datatable to surpass in my asp.net project. It worked dustlike in localhost. But when I uploaded my send in computer it does not work. Actually the .aspx tender itself is not loading. My Function is as follows,

Private Sub ExportToExcel()
FillString()
Dim ConnString As String = ConfigurationManager.ConnectionStrings("sewaonlineConnectionString").ConnectionString
Dim da As New SqlDataAdapter(sqlString, ConnString)
da.Fill(ds) 

dt = ds.Tables(0) 

Dim surpass As New Microsoft.Office.Interop.Excel.ApplicationClass
Dim wBook As Microsoft.Office.Interop.Excel.Workbook
Dim wSheet As Microsoft.Office.Interop.Excel.Worksheet 

wBook = excel.Workbooks.Add()
wSheet = wBook.ActiveSheet() 

Dim dc As System.Data.DataColumn
Dim dr As System.Data.DataRow
Dim colIndex As Integer = 0
Dim rowIndex As Integer = 0 

For Each dc In dt.Columns
colIndex = colIndex + 1
excel.Cells(1, colIndex) = dc.ColumnName
Next 

For Each dr In dt.Rows
rowIndex = rowIndex + 1
colIndex = 0
For Each dc In dt.Columns
colIndex = colIndex + 1
excel.Cells(rowIndex + 1, colIndex) = dr(dc.ColumnName) 

Next
Next 

wSheet.Columns.AutoFit()
Dim strFileName As String = "Workbook.xls"
Dim blnFileOpen As mathematician = False
Try
Dim fileTemp As System.IO.FileStream = System.IO.File.OpenWrite(strFileName)
fileTemp.Close()
Catch ex As Exception
blnFileOpen = False
End Try 

If System.IO.File.Exists(strFileName) Then
System.IO.File.Delete(strFileName)
End If 

wBook.SaveAs(strFileName)
excel.Workbooks.Open(strFileName)
excel.Visible = True 

End Sub 

Protected Sub btnExport_Click(ByVal communicator As Object, ByVal e As EventArgs) Handles btnExport.Click
ExportToExcel()
End Sub

Note: I had additional a meaning to Microsoft.Office.Interop.Excel in my send for this function. I had also proclaimed the datatable (dt) as orbicular variable.

What haw be the reason?

Also I would revalue if you could propose whatever change in the above

Related posts:

  1. MICROSOFT.OFFICE.INTEROP.WORD WORKS IN DEVELOPMENT MACHINE WITH VS BUT "SYSTEM.RUNTIME.INTEROPSERVICES.COMEXCEPTION (0×800A1098): THIS COMMAND IS NOT AVAILABLE BECAUSE NO DOCUMENT IS OPEN." ON DEPLOYED TO IIS Hi, My ASP.NET application needs to read a word document (.doc or .docx) on the server, then get the...
  2. DEPLOYING EXCEL INTEROP DLL TO PRODUCTION MACHINE Catch 22. I'm using the Excel Interop DLL version 11 to enable importation of Excel xls files. ASP.NET framework...
  3. VB 2008 DEPLOYMENT ISSUES EXCEL/GAC Hi, I recently developed a vb 2008 express app using the Excel 2007 object. The end user has Excel...
  4. READ WRITE EXCEL IN .NET I want to read write excel file in my application without installing the office on my server. Means my...
  5. HOW DO I SPECIFY PASSWORD FOR A PASSWORD PROTECTED PPT FILE THROUGH VB.NET Hi All, Am trying to open a .pps/.ppt file through my vb.net code.....due to secure reasons this file is...
  6. ASP.NET EXPORT EXCEL ISSUE Is there file size limit while exporting excel 2007 file using Microsoft.ACE.OleDB driver from ASP.Net? I can export file...
  7. MICROSOFT OFFICE PROJECT SERVER 2003 Sams | June 15, 2005 | English | ISBN: 0672327430 | CHM | 888 pages | 34 Mb This...
  8. CREATE AND SAVING EXCEL FILE Hi all, I am developing a web application that will create the Excel file from the data of data...
  9. OUT LOOK hi i am using Microsoft.Office.Interop.Outlook.dll for reading the appointments of outllok calender to my asp.net application its working fine...
  10. MICROSOFT OFFICE ACCESS DATABASE ERROR. Hi guys, Everything is working fine on client side. Now i just add my web application to IIS and...

Tags: , , ,

Leave a Reply

You must be logged in to post a comment.