Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Help with importing excel files

Reply
Thread Tools

Help with importing excel files

 
 
pmb88 pmb88 is offline
Junior Member
Join Date: Jan 2011
Posts: 3
 
      02-26-2012
I am creating a web application that imports excel files into a database. What occurs is that i have several excel files that I need to import from excel into a database. These files could be excel 97-2003 or excel 2007/2010. I have it determine which filetype it is and use the particular connection. This is how my code looks.
Code:
Dim strconn As String
       If fileextesnison = ".xlsx" Then
            strconn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + filepath + 
  ";Extended Properties=""Excel 12.0 Xml;"";"
      ELSE
            strconn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filepath+ 
";Extended Properties=""Excel 8.0;"";"
      End if
Dim strSQL as string = "SELECT * FROM RangeName"
Dim olConn As New OleDbConnection(strconn)
Dim oadapter As OleDbDataAdapter
    olConn.Open()
Dim od As New OleDbCommand(strSQL, olConn)
    oadapter.selectcommand = od
Dim oData as dataset 
       oadapter.fill(odata, "Data")
       olConn.Close()
Before the above process happens I am using softartisan excel writer to add a range name cause I am using the range name to select the data and adding [ and ] in the column names in case the column names are not valid database column name format. The issue is that when I try to import the file that is excel 97-2003 it gives me the microsoft jet database engine could not find 'RangeName' and please make sure that the path and filename is correct. When I try this with excel 2007/2010 it imports the file and have no issues. I have checked the filepath and it is directing to the proper file. What could be the issue that is occurring here?
 

Last edited by pmb88; 02-26-2012 at 10:24 PM.. Reason: added a sentence
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Excel reports ::::Excel 2003 Migration To Excel 2007 =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?= ASP .Net 15 10-24-2007 01:34 PM
Importing excel Ciscoworks files into Visio Paul Cisco 0 03-15-2006 01:01 PM
How to keep a module with the same name as a module it is importing from importing itself? plb Python 2 02-08-2005 03:14 PM
exporting an excel file from database; making changes to excel file and updating the database by importing it back Luis Esteban Valencia ASP .Net 1 01-12-2005 12:28 AM
Importing Data into Excel =?Utf-8?B?anBpZWtzemE=?= Microsoft Certification 2 08-29-2004 06:37 AM



Advertisments