I am using asp.net oledb to export information to excel file. I encounter problems when the information to export becomes too big, in this case the code I have given below, the excel file generated becomes an empty spreadsheet. If I changed the loop to 1123 for insertion of the rows. The generated excel file is fine, 1125 rows, and 4 columns shown. A test program in windows form is also working fine regardless of how many rows. Code has been simplified, "information ..." in the sql insertion command represents 1803 characters.
ExcelObjConn = "Provider=Microsoft.Ace.OLEDB.12.0;" & _ "Data Source=" & fileName & ";Extended Properties=Excel 12.0 XML" ExcelConnection = New System.Data.OleDb.OleDbConnection(ExcelObjConn) ExcelConnection.Open() Try SqlCommand = "CREATE TABLE ABC ([row1] text, [row2] text, [row3] text, [row4] text)" ExcelCommand = New OleDb.OleDbCommand(SqlCommand, ExcelConnection) ExcelCommand.ExecuteNonQuery() ExcelCommand.Dispose() For i As Integer = 0 To 1124 SqlCommand = "Insert into ABC ([row1], [row2], [row3], [row4]) Values ('information...', 'information ...', 'information ...', 'information ...')" ExcelCommand = New OleDb.OleDbCommand(SqlCommand, ExcelConnection) ExcelCommand.ExecuteNonQuery() ExcelCommand.Dispose() Next Catch ex As Exception Finally If ExcelConnection IsNot Nothing Then ExcelConnection.Close() ExcelConnection.Dispose() End If End Try
I couldn't find a solution to my problem as well. What I did eventually was to run the process using another separate windows service. The code works perfectly fine running from a windows form or service program, but not asp.net, not sure why.
I have tried using GridView control to display the data from SqlDataSource control but there are just so many columns and one of the fields contains a lot of texts so using GridView control to display the data does not look look since it goes out of the master template. I have tried using GridView control to display my data and use the following code to export as Excel but in case, there are just so many columns.
What are some other better ways to export to Excel file from my web page?
I am working in a project where i need to export the Gridview data into an Excel file. after that in the newly geretated excel sheet i want to put some formula so that it gives the sum of all the columns. Exporting data into an excel file is done Using following code
how can i enter formula dynamically in excel sheet.
I need to export SQL query results to an Excel file.
I use the following code to do it.
Works fine for majority of the cases. There is a column called Description in the query results which is of type nText in the sql database. This can have lengthy data ( couple fo paragraphs) . When the number of charcters are large only the first portion of the data is showed and it trims the rare portion. how I can avoid this? Or any efficient code example on how I can do this in a different manner
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not Me.IsPostBack Then Dim dataSet1 As New DataSet dataSet1 Dim dataSet2 As New DataSet dataSet2 Dim dataSet3 As New DataSet dataSet3
Dim dataSets As New List(Of DataSet)() dataSets.Add(dataSet1) dataSets.Add(dataSet2) dataSets.Add(dataSet3) Dim strout As String = Server.MapPath("test1.xls") DataSetsToExcel(dataSets, strout) End If End Sub
How to create each excel sheet non-editable (read only)
i want to export an excel from my web application and want to save it on Web Server, but i am not able to save it on web server, i am able to do it on my local machine, but on web server it's not working.
I have an Excel file called Products.xls .I have Columns A and B, with the titles NAME and QUANTITY.The name of the sheet is SHEET1.The file has about 40 lines.How do i show these data on a Gridview or Listview ?
I have a file pdf, in file pdf of me has a table with many columns. How to Fill data from file pdf to columns of file Excel?I want fill data from file table of file pdf to file excel following format of file pdf.
I used this coding for export to excel, by using this coding i got only 65,536 rows only. How to bind more than 65,536 records or how to move the balace records to sheet 2 by using this method.
Protected Sub btnExportExcel_Click(ByVal sender As Object, ByVal e As EventArgs) Dim ars_stock As New DataTable ars_stock = cls.FillDataTable("select top 70000 * from spal..po_acc_details") Response.Clear() Response.Buffer = True
I'm exporting data to an excel sheet from the ojects list. The data is exporting to excel sheet well, but I'm unable to see the grid format for the data. The data is looking with out the rows and columns lines.I think I'm missing to set some property or somethnig ehwn exporting.
I have code to export the grid to excel . i have taken it from [URL] now i want to save excel file directly without asking user to save it or open it at client side. i want to save it on server folder. how to do that .
I expect that the export file will be backup.sql mysqldump --tables -u db_user_name -p db_name >> backup.sql Furthermore, is there any example for that we insert one record with one image file (from the local disk), to the DB table?