how to import excel file into sql database table?

Posted by Vforvijay under Regular Expressions on 2/7/2011 | Points: 10 | Views : 11831 | Status : [Member] | Replies : 10
hi...i need the solution for import the excel sheet data into sql database table...?plz its urgent




Responses

Posted by: T.saravanan on: 2/7/2011 [Member] [MVP] Silver | Points: 25

Up
0
Down
Hi,

Refer this link for read a excel file into dataset...
http://www.dotnetfunda.com/codes/code972-read-a-excel-file-with-sheet-wise-into-dataset-using-csharp-.aspx
Using that dataset to pass the value into your database for insert (or) update...


Cheers :)

Thanks,
T.Saravanan

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

Posted by: Prabhakar on: 2/8/2011 [Member] [MVP] Starter | Points: 25

Up
0
Down
Hi Vforvijay

it's very simple . you go with sql database then right Click on Database

All tast -> Import Data
Then set Data source on Browse Select your Excel File then next .
hope fully it's a use full for you

Best Regard's
Prabhakar

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

Posted by: Karthikanbarasan on: 2/8/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
HI,

Check these MSDN links

http://support.microsoft.com/kb/321686
http://support.microsoft.com/kb/306125

Thanks
Karthik
www.f5Debug.net

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

Posted by: Vforvijay on: 2/8/2011 [Member] Starter | Points: 25

Up
0
Down
plz anyone give me through code the code to convert

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

Posted by: Prabhakar on: 2/9/2011 [Member] [MVP] Starter | Points: 25

Up
0
Down
Hi vijay


i think u need to export Datbase to Excel . So you Read My article

http://www.dotnetfunda.com/articles/article1150-all-in-one-export-data-in-aspnet-gridview-to-doc-%E2%80%93-gridview-to-excel-%E2%80%93-gr-.aspx

it's a hope full for u

Best Regard's
Prabhakar

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

Posted by: T.saravanan on: 2/9/2011 [Member] [MVP] Silver | Points: 25

Up
0
Down
Hi,

Refer this...http://www.davidhayden.com/blog/dave/archive/2006/05/31/2976.aspx

If you want to read the data from excel in code behind after to insert into table means refer my above answer...


Thanks,
T.Saravanan

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

Posted by: Karthikanbarasan on: 2/9/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
Vijay,

In both the links which i posted it has the code... u can follow the same and make use of it

Thanks
Karthik
www.f5Debug.net

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

Posted by: Ravinderreddy on: 9/24/2012 [Member] Starter | Points: 25

Up
0
Down
hi I am importing data from one database to another database i am getting so many errors please give me solution

- Copying to [erpravikumar].[dbo].[Suppliers] (Error)
Messages
* Error 0xc0202009: Data Flow Task: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft OLE DB Provider for SQL Server" Hresult: 0x80004005 Description: "Invalid character value for cast specification.".
(SQL Server Import and Export Wizard)

* Error 0xc020901c: Data Flow Task: There was an error with input column "Column 22" (165) on input "Destination Input" (115). The column status returned was: "The value could not be converted because of a potential loss of data.".
(SQL Server Import and Export Wizard)

* Error 0xc0209029: Data Flow Task: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "input "Destination Input" (115)" failed because error code 0xC0209077 occurred, and the error row disposition on "input "Destination Input" (115)" specifies failure on error. An error occurred on the specified object of the specified component. There may be error messages posted before this with more information about the failure.
(SQL Server Import and Export Wizard)

* Error 0xc0047022: Data Flow Task: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Destination - Suppliers" (102) failed with error code 0xC0209029. The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running. There may be error messages posted before this with more information about the failure.
(SQL Server Import and Export Wizard)

* Error 0xc0047021: Data Flow Task: SSIS Error Code DTS_E_THREADFAILED. Thread "WorkThread0" has exited with error code 0xC0209029. There may be error messages posted before this with more information on why the thread has exited.
(SQL Server Import and Export Wizard)




Ravindrareddy

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

Posted by: T.Saravanan on: 9/25/2012 [Member] [MVP] Silver | Points: 25

Up
0
Down
Hi Ravindrareddy,

Based on the error, I understood the below...
1) Could you verify, both the source and destination table(s) columns have same datatype or not?
2) If you using datatype conversion, check the length of the datatype (Varchar, Decimal) ?
3) I hope you are using SSIS package for data loading. If you face any unicode conversion error, use DataConversion control for "Varchar" to "NVarchar" (or) "NVarchar" to "Varchar".

Thanks,
T.Saravanan

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

Posted by: Hariinakoti on: 9/25/2012 [Member] Starter | Points: 25

Up
0
Down
nice links Karthikanbarasan

Thanks & Regards
Hari

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

Login to post response