Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 5th, 2005, 03:13 PM
Registered User
 
Join Date: Jun 2005
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!

 
Old August 19th, 2005, 08:55 AM
Registered User
 
Join Date: Aug 2005
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.

 
Old August 22nd, 2005, 05:20 AM
Registered User
 
Join Date: Feb 2005
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





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 01:21 AM
Upload a file to sql server database thas123 ASP.NET 1.0 and 1.1 Professional 3 January 9th, 2006 12:29 AM
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





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