.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How to do wide search and export the records to excel file in ASP.net C# ?

Posted By:      Posted Date: August 27, 2010    Points: 0   Category :ASP.Net

This is my MYSQL  database connection :-

public static OdbcConnection Connection = new OdbcConnection("Driver={MySQL ODBC 5.1 Driver};Server=localhost;Database=jdmcrm; User=root;Password=admin;");

My table name is "customer" and  fields liek customerId , companyName , address and date ;

How to do wide search and export the records to excel file ? im quite new in asp.net .

Pls advise . Thanks





View Complete Post

More Related Resource Links

Excel file not showing in search results

We have a strange issue. I have one Excel document (or at least one that I am aware of) that will not show up in search results for content within the document. I can find the document by title just fine, but when I search for words within the document I do not see it. The document was originally a 2003 Excel document and was recently converted to 2007. Other than that there isn't really anything unusual about it (some formatting stuff, but mainly just background colors and whatnot, nothing fancy). The crawl log shows the document was crawled without error. Anyone know anything else I can check on?

Unable to export data to an excel file in grid format!!!

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.   Any help would be really appriciated.

How do you freeze the tablix header row in an Excel export file in SSRS 2008?

So this is totally killing me. I've found out how to make a tablix header row repeat on each page of a PDF export file in SSRS 2008 (which I won't even get started on because all I can say is that 2005 is way better), but I cannot figure out how to make a simple header row of a tablix freeze in an Excel export file.  The tablix is right at the top of the body and spans the entire width of the design area.  How in the world do you get it to freeze in the Excel export file?

SharePoint 2010 Export list Items to Excel, wrong url in iqy file

Hi, I have a SharePoint 2010 Environment that uses https://portal.<something>.com. Exporting to Excel of a list uses wrong URL. When I go to the a list, select the list to show the "office ribbon" and then select export to excel, excel will show the error "Excel cannot connect to the SharePoint List". When I take a look at the IQY file that is created it contains the wrong url: http://portal.<something>.com instead of https://portal.<something>.com Changing the URL in the IQY file manualy to https://portal.<something>.com and then opening it will excel is working fine, list data is exported to excel then. Alternate access mapping is configured to use https://portal.<something>.com as default, export to access is working normaly. I already deleted the http://portal.<something>.com alternate access mapping once to see if this fixes the problem. No fix, even not after IISreset or rebooting the server. Where or how is the export to Excel IQY file created and where is it possible to fix the URL it is putting in the IQY file? Grtz, Arjan

Data Export to Excel file using "Response.ContentType = "application/csv"


I have developed code to export data to Excel using Response.ContentType = "application/csv". The output Data Excel file loaded with 65536 Rows only, this file is not loaded completely since the limitation of excel is 65536. My Recordcount is more than 700000.

Please any one let me know how I can Export Data to Excel file over than 65536 Rows.

Email: thamaraiselvann@ayso.org

can I use SQL Server to export an excel file directly?


I just want to know except use owc

can we use SQL Server to export excel file ?

if it can be , how to do? thanks alot

When i export a MS Excel file generated By SSRS 2008 i'm not able to change the sheet name (Sheet 1

When i export a MS Excel file generated By SSRS 2008 i'm not able to change the sheet name (Sheet 1,Sheet 2,Sheet 3) dynamically.So Please try to give me a solution.

When i export a MS Excel file generated By SSRS 2008 i'm not able to change the sheet name (Sheet 1



When i export a MS Excel file generated By SSRS 2008 i'm not able to change the sheet name (Sheet 1,Sheet 2,Sheet 3) dyanamically.Sp Please try to give me a solution.

Export to Excel gives error before opening file


I have a web page with a gridview control and a button for Exporting to Excel

I get following error when exporting to Excel.

"The fiel you are trying to open, 'someFileName[1].xls, is in a different format than specified by the file extension. Verify that file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?"

Clicking Yes opens the file. I would like to avoid showing the above error to the users.

Following code is used from the click event. I've left the commented code here to show what I've tried based on results from internet search. I have Microsoft Office Excel 2007 on local PC.

public static void ToExcel(DataTable dt, string fileName)
			string attachment = "attachment; filename=" + fileName + ".xls";

			GridView gvExcel = new System.Web.UI.WebControls.GridView();
			gvExcel.AutoGenerateColumns = true;
			gvExcel.DataSource = dt;

			//HttpContext.Current.Response.AddHeader("content-disposition", attachment);
			//HttpContext.Current.Response.ContentType = "application/ms-excel";
			HttpContext.Current.Response.ContentType = "application/vnd.ms-excel";

Export millions of records from database (Oracle) to excel


Hey guys, I'm running a query that brings millions of records and makes the server run out of memory. I'm thinking I should get the data in chunks. So I was wondering if someone could shed some light on this or point me to another place where I can read further.

Currently, I just implemented "paging". I can now pass a "page index" parameter and "page size". So I could call 1,000 times the stored procedure with a page size of 1,000 (for 1 million records). This might be an option, but I wanted to hear someone else's opinion on how to "stream" records from oracle to the web server and then to a file.


Is there a way to export a datagrid to an Excel or html format file?

Hi all.. thanks for taking the time to help in advance!! :)

I've written a win application that has a datagrid which displays certain contents from a database, is there a way to allow the user to export the contents of that datagrid to maybe an excel file or html file so they can print it out themselves? I've done a lot of googling and most i could find were for web applications and not winform.. can someone point me in the right direction?

Thanks very much guys! :)

SharePoint add-on to search Excel file?



I'm looking for an add-on or a way within SharePoint 2010 that allows me to upload a document (XLS, DOC, PDF) and have that kick off a workflow that searches that document for occurences of a specific name.  Essentially, I want Excel's HLOOKUP functionality to be triggered and report back after I upload a doc.

For example:  Let's say I've got a shopping list in Excel with 2 columns - ITEM and PRICE.  I upload SHOPPING LIST to a SP Library.  I want it to then populate a SP List with every occurrence of word 'TOMATO' and the price next to it.

How does one accomplish this?





Export Visio Database Table Names to Excel

If you use the Enterprise Architect edition of Microsoft Visio for data modeling regularly, then there is a good chance that at some point you've wanted to export just the table names into Excel. You might want to do this to map logical ERD entities to physical data model tables, track project status by entity, or track overlap between database versions.

Export SharePoint List to Excel Spreadsheet Programmatically using C#

In SharePoint applications, Custom Lists are used to store business data and Document Libraries to store the documents. But for data manupulation and analysis, Microsoft Excel provides very rich features as compared to SharePoint Lists. That's why people still loves to work on Microsoft Excel Sheets.

Creating Excel file from C#

I used below coding for create a excel sheet.I got from on web site.
In below coding there is no problem.Its create the excel file.If i run second time,its ask to overwrite the current excel file.If I said "Yes" then it ok ,but If I select cancel button,its generate the Error message.The exception is

Convert excel file into xml


Hai, I have two columns with id,name in the excel sheet.I want to convert into xml file in the below format

<?xml version="1.0" encoding="utf-8"?>

<guide xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Boat id="1"> <name> Copper Kettle </name> </Boat> <Boat id="2"> <name> Copper Penny </name> </Boat> <Boat id="3"> <name> Copperhead </name> </Boat> <Boat id="4"> <name> Coppertone </name> </Boat> <Boat id="5"> <name> Copy Boy </name> </Boat> </guide>

suggest me with sample code in ASP.NET. Thanks


Read Excel file from Web Application (C#)



I have a web app where user uploads a file.

File is saved in server locally and I want to read some data from it.

Currently my development  server has office 2003.

So do I need office 2007 in order to be able to  read an excel from office 2007 ?

What are other requirements  ?

I tried a test, using

Microsoft.Office.Interop.Excel.Application excelApp = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel.Workbook wrkBook; // = new Microsoft.Office.Interop.Excel.Workbook();

wrkBook = excelApp.Workbooks.Open(@"C:\www\excel_files\b.xls", ....);

But When trying to open the file I get the error:

Exception from HRESULT: 0x800A03EC

So I'm wondering what I'm missing.


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend