Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 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
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old August 5th, 2005, 03:13 PM
Registered User
 
Join Date: Jun 2005
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Upload .xls file to SQL Server

I got so far as to take a file from my local machine to another directory on my C: drive:

Dim getmyFile As HttpPostedFile = myfile.PostedFile
If IsNothing(getmyFile) Then
   Label2.Text = "Please select a file to upload"
   Label2.Text = "Line 78"
Else
   If getmyFile.ContentLength = 0 Then
     Label2.Text = "Cannot upload zero length file"
   Else
     Dim ServerFileName As String = Path.GetFileName(myfile.PostedFile.FileName)
     getmyFile.SaveAs("C:\TestSaving\" & ServerFileName)
     Label2.Text = "Successful upload to C:\TestSaving\" & ServerFileName
   End If
End If

...............now, what I need to do is take an .xls file and allow users to upload that into a specific table.
Any suggestions or samples/articles are more than welcome!

Thanks!

  #2 (permalink)  
Old August 19th, 2005, 08:55 AM
Registered User
 
Join Date: Aug 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Once you have your Excel file on the server it all becomes relatively easy. Check out the Wrox book 'Beginning ASP.NET Databases Using VB.NET'. There are a couple great examples of how to use OleDBConnection objects to connect to an Excel file. Once you have the contents of your Excel file loaded into a DataSet object you can send it to SQL Server.

  #3 (permalink)  
Old August 22nd, 2005, 05:20 AM
Registered User
 
Join Date: Feb 2005
Location: , , United Kingdom.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to vije
Default

Hi,
DTS in SQL server is a nice tool when you wanna import export data to/from other data soureces.
Regards.
-VJ
 


Thread Tools
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
To upload an excel file to to sql server. Abins ASP.NET 1.0 and 1.1 Professional 2 February 22nd, 2006 12:21 AM
Upload a file to sql server database thas123 ASP.NET 1.0 and 1.1 Professional 3 January 8th, 2006 11:29 PM
Upload a Text file from a Web Client to SQL Server petercyriljones Classic ASP Professional 0 May 20th, 2005 10:26 AM
Upload file into a Remote Server swaminathanb Java GUI 2 April 7th, 2005 02:04 PM
upload a xls file into database blob column gummadis Pro VB Databases 0 September 14th, 2004 12:12 PM



All times are GMT -4. The time now is 12:45 AM.


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