Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 22nd, 2006, 03:30 AM
wk wk is offline
Authorized User
 
Join Date: Aug 2006
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default Read excel file into database

Dear all,

May I know how can i read an excel file into database. I'm using visual studio 2005 and c#

Thanks

wk

Reply With Quote
  #2 (permalink)  
Old August 22nd, 2006, 09:58 AM
Friend of Wrox
 
Join Date: Feb 2006
Location: , , USA.
Posts: 116
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I previously used DTS (Data Transformation Services) to successfully upload Excel Spreadsheets into SQL Server 2000.

For Sql Server 2005 I think what you want to look up is Sql Server Integration Services, which replaced DTS.

Neil Timmerman
Programmer II
School of Medicine
University of Missouri Columbia
Reply With Quote
  #3 (permalink)  
Old August 22nd, 2006, 08:02 PM
wk wk is offline
Authorized User
 
Join Date: Aug 2006
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

T
hanks, I'm using sql server 2k as well. :)

But is there a way to read the excel file into database by writing it in c#?
Reply With Quote
  #4 (permalink)  
Old August 23rd, 2006, 10:07 AM
Friend of Wrox
 
Join Date: Feb 2006
Location: , , USA.
Posts: 116
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It's really easy to upload an excel spreadsheet using DTS in SQL Server 2k and it works great and you can do it using a wizard-like point and click interface in the enterprise manager.

To do this, right click over a table (any table), select "All Tasks", then "Import Data...", and that brings up the DTS Import/Export Wizard. For data source, select "Excel 97-2000". Either that or save your file in CSV format and use one of the *.csv drivers. From there it's pretty easy. You have to make sure the data in your spreadsheet can be converted to the datatypes on the columns in the table you are uploading to. Watch the dates. In my experience its often been easiest to make a new table with no constraints of any kind, and varchar everything, import the data into that table, then use SQL to "massage" it into what I want, and THEN import it to the table(s) I actually want it in.

I don't understand what you mean by "writing it in C#". What do you want to write in C#? A windows form? An ASP.NET site? If you are making an upload form in ASP you will need Office Web Components (OWC).

Neil Timmerman
Programmer
Veris Consulting
Reply With Quote
  #5 (permalink)  
Old August 23rd, 2006, 10:20 PM
wk wk is offline
Authorized User
 
Join Date: Aug 2006
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Neil,

Sorry for misleading you. Please correct me if I'm wrong.

I have an empty DB currently and I need the uploaded excel files from my users to fill in the data in my DB. I know I can do that by using the DTS but as my users will append the data in the same excel files and upload it again and again so I'm thinking of writing a C# code which is put together in the upload page from the users so that when the excel files are uploaded by users to the server then the appended data will be automatically fill in my db as well. I have the solution on how to retrieve all of the data from the excel files but now my problem is I don't know how to write it to the database.

Hope this make sense.
Reply With Quote
  #6 (permalink)  
Old August 24th, 2006, 10:44 PM
wk wk is offline
Authorized User
 
Join Date: Aug 2006
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Problem solved :)

Reply With Quote
  #7 (permalink)  
Old September 6th, 2006, 11:52 AM
Registered User
 
Join Date: Sep 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by wk
 Problem solved :)

Hi WK

Can you tell me how it got solved. I am also in your situation. Only difference is this would be a browser upload.
Reply With Quote
  #8 (permalink)  
Old June 12th, 2007, 06:53 AM
Registered User
 
Join Date: Jun 2007
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi WK

Can you tell me how it got solved. I am also in your situation.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to read data from an excel file diegoblin Beginning VB 6 6 August 31st, 2009 11:04 PM
Read Data from Excel File kiwibey ASP.NET 2.0 Professional 1 December 5th, 2006 11:27 AM
how can read excel file abrahamchempanal RSS and Atom 0 February 22nd, 2006 10:52 AM
Read Excel File rekha_jsr Classic ASP Basics 2 June 16th, 2005 04:58 AM
Read an uploaded Excel File rekha_jsr Classic ASP Basics 0 June 12th, 2005 10:17 PM



All times are GMT -4. The time now is 02:58 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.