.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

Uploading excel data to sql database in asp.net application

Posted By:      Posted Date: September 18, 2010    Points: 0   Category :ASP.Net
Hi All,  What is the efficient way to upload excel data to sql database?excel file consists of 4000 rows..so i need to save these records to sql database in web application,i know only by creating ODBC connection i.e_path = @"Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=" + _path;OdbcConnection _xlsConn = new OdbcConnection(_path);_xlsConn.Open();OdbcCommand _xlsSelSht = new OdbcCommand("Select " + columns + " FROM [" + _sheet + "$]", _xlsConn);OdbcDataReader _xlsReader = _xlsSelSht.ExecuteReader();while (_xlsReader.Read()){.....}Is this efficient way ? keeping in mind speed because huge data needs to upload...   thanks in advance...  

View Complete Post

More Related Resource Links

Insert Excel Data via File Upload into sql server database???

Hi all, I have requirement that User can Upload the Excel Sheet Data to sql server Database at once. How i do that Any Article or hint is apperciated.   Regards 

Questions on Multi-Tenant Data Architecture for SQL Server Database and ASP.NET application

My company wants me to make the same asp.net application and sql server database be sharable amongst different clients. Clients will use the database for their own business use, will have their own data, we will have our own data. How can I share the same SQL Server database amongst different clients having same ASP.NET application (but somehow be able to differentiate which client user is logging in) ? Do I need to use ApplicationID and how will I detect at login which one to use ? I know I will need to add another field in all tables to differentiate client's data from ours.  

Importing Excel 2007 data into SQL 2005 database

I have a SQL 2005 cluster installation without SSIS and without management studio (I didn't install it). Now we need to import data from an excel 2007 file into a specific table in a database. I have tried doing this from a remote management studio, BI development studio and DTSwizard but I can't seem to make it work. The error message from BIDS is that "the data source is on a remote computer..." Does any of you have a step by step  guide that works from a remote location. BR Rasmus    

What's the best way to store Data from DataBase like XmlNode... Application vs Cache


 Hello, i am building an N-tier application now i want to store Data(like XmlNode) that is common to all users ..

now i thought using Application to hold the data but my data lays in the BLL tier which is an Class Library project and i can't store any datain there for example :

HttpApplication MyApp=new HttpApplication();



My question is what is the best way to store Data (not small data like user name etc..) is it Application? orCache?

i would like a small example within a ClassLibrary project...


Reading Excel data to SQL database



Using C# to develop an application.

I need to upload data ( which is in excel) to a sql table.

This is the code I have.

public ReadExcel(string strFileName,string strRegion)
        string strFilePath = string.Concat("c:/BulkUpload/", strFileName);
        myDataSet = new DataSet("Excel_DataSet1");
        string myConnectionString;
        OleDbConnection myConnection;
        OleDbDataAdapter myAdapter;
        myConnectionString = "provider=Microsoft.Jet.OLEDB.4.0;data source='" + strFilePath + "';Extended Properties=Excel 8.0;";
        myConnection = new OleDbConnection(myConnectionString);

        myAdapter = new OleDbDataAdapter("select * from [sheet1$]", myConnection);

        DataTable dt = myDataSet.Tables[0];
        int count = 0;
        foreach (DataRow r in dt.Rows)
            if (count != 0)
                DBConnect db = new DBConnect();
                db.AddData("INSERT INTO " + strRegion + "(Country,ProjectOwner,State,County,ProjectName,Quarter,Manager,Comments) VALUES ('" + r[1].ToString() + "','"

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

Export data to Excel from SQL Server in asp.net application


Hi Experts,

I need some guidence, how can I achive this and what is the best and fast way to do so?  

I want to create an application for users, where users can go and select any given Stored Proc (link), then Pass parameters accordingly and export result directly to Excel 2007.  it will be simple data extraction web application to export big chuck of data from SQL server 2008.  No gridview please since the result set will be around million rows.

did anyone has developed similar application or project? or guide me or provide any link will be helpful.  

Please help. 

Thank you :)

Error in Uploading Files to Access 2010 Web Database Table with Data Macro


Hi All,


I've recently published an Access 2010 Web Database to the SharePoint 2010 farm in my organization and I'm having the strangest problem.

I have a table which includes an Attachment field. When trying to upload a file through the web I get the following error: "There was an error uploading your attachment to the server".

Now, this table has a "Before Change" Data Macro, which basically executes a simple LookUp of several parameters from another table and writes them back to the "master" table. When deleting this Data Macro, upload on the Web works fine.

The thing is that when working from the local Access file (connected to the SharePoint) and trying to change a field in the table, the following error is received: "The Microsoft Access database engine encountered an error whil

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.

MVC architecture in ASP.Net using C# and Microsoft Data Access Application block

The Model-View-Controller (MVC) pattern separates the modeling of the domain, the presentation, and the actions based on user input into three separate classes [Burbeck92]:

Model. The model manages the behavior and data of the application domain, responds to requests for information about its state (usually from the view), and responds to instructions to change state (usually from the controller).

View. The view manages the display of information.

Controller. The controller interprets the mouse and keyboard inputs from the user, informing the model and/or the view to change as appropriate.

display data into GridView from excel sheet

I have to display data from excel sheet into my gridview and also I need to figure out a way to store data into excel files from my web page. I am using C# 3.5, VS 2008.

Creating an Excel Spreadsheet and Adding Data to It Programmatically

The Interoperability services make it veryeasy to work with COM Capable Applications such as Word and Excel. Thisarticle reveals using Excel from a managed application. Excel is thespreadsheet component of Microsoft Office 2000. The majority of Excelprogrammatic functionality is exposed through Automation via the typelibrary Excel9.olb. The intention of this article is to express that amanaged application can interrelate with Excel as a COM server.

Creating a Smartphone Application and Using Data from SQL Mobile

In this exercise, you will use Visual Studio 2005 to create a Smartphone application. You will associate commands with a mobile device's soft keys, and you will add the ability to scroll through the list of available products (a list of images). You will create a data source for an existing SQL Mobile database, and then test the application in the Windows Mobile 5.0 emulator.

In the following procedure, you will create a new Windows Mobile 5.0 project in Visual Studio.

Linq - add data to database then email user the details


Hi all

I'm not sure how to structure the code for this but what I want to do is be able to add data to a database, and once this has completed successfully, then email the user to say the details have been added successfully to the database.

I need to:

1. Check that the relevant data has been added into the database then

2. Email the details of the relevant data when completed. 


Thanks in advance for your help,




huge number of data from database ... so how to minimize load time


Hi ...

I have used the above method to configure my crystal report ...

Its working fine , But i have huge number of data in database ....

So , it take long time to load the report ...

So , i have decided to show only the last 50 records inserted into the database , not all the 500 records to be loaded every time.

Plz help me with this issue  ...


Also , Plz explain me abt index legend in crystal report.

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.


Saving textbox data to MySql database in asp.net


Hi dear coders

though a very simple question to ask, but please tell me how to save and retrieve data in/from my textboxes to/from database (MYSQL) on submit button click.

i know its a very simple task but i cant make it done, so i request you to please send me some working example link or post any helpful code here in asp.net

i will be highly thankful for any kind help from you geniuses.



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