how to Import data from EXCEL to SQL Database in ASP.NET [Resolved]

Posted by Mandlaa under ASP.NET on 5/9/2013 | Points: 10 | Views : 10886 | Status : [Member] | Replies : 8
Hi,how to Import data from EXCEL to SQL Database in ASP.NET

I am tying two approuches But not solve my problem,
I am getting an error like this

ERROR:
Please once see my code i am attachment

please help me

SQL TABLE CODE:
CREATE TABLE [dbo].[Book1](
[ID] [int] NULL,
[NAME] [varchar](50) NULL,
[CITY] [varchar](50) NULL
)




Responses

Posted by: Mandlaa on: 5/9/2013 [Member] Starter | Points: 25

Up
0
Down
Hi ,I am trying this but getting this error in my systen

ERRO:External table is not in the expected format.

Mandlaa, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 5/9/2013 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
Guys please format your Code into a Code Tag supplied to you on the toolbar

Thank you for posting at Dotnetfunda
[Administrator]

Mandlaa, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Learningtorise on: 5/9/2013 [Member] Starter | Points: 25

Up
0
Down
You can use Import Wizard of SQL for same.... Its easy and fast...

To create an Excel connection from the SQL Server Import and Export Wizard:

Right Click on DB Where you want to import, select Tasks>Import Data...

This will start the 32-bit version of the SQL Server Import and Export Wizard.

On the Choose Data Source, select Microsoft Excel, and then configure the Excel connection.

http://hashtagakash.wordpress.com/

Mandlaa, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Mandlaa on: 5/9/2013 [Member] Starter | Points: 25

Up
0
Down
Thank you so much ,it's working fin


Mandlaa, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Mandlaa on: 5/9/2013 [Member] Starter | Points: 25

Up
0
Down
It's working fin,

string ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + Server.MapPath("~/sample.xls") + ";" + "Extended Properties=Excel 8.0;";

The above code given:Server.MapPath("~/sample1.xls")
i can use dynamically apply this filename when i am Uploadfile,Don't use the staticd file name
For suppose i want upload"sample1.xls' it's not working

Mandlaa, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Valley on: 5/9/2013 [Member] Starter | Points: 25

Up
0
Down
http://www.66pacific.com/sql_server_import_from_excel.aspx

Mandlaa, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Shekhar04 on: 6/23/2013 [Member] Starter | Points: 25

Up
0
Down
For import data into database from excel check the below link
http://chauhanshekhar.blogspot.in/p/how-to-import-data-from-excel-to-sql.html
this will help you to resolve your issues....Hope this will like you...!

Mandlaa, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Priyagoel_24 on: 7/23/2013 [Member] Starter | Points: 25

Up
0
Down
hello friend
please help me
how to export data from sqldatabase to excel asp.net
thankyou


Mandlaa, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response