Current location: Hot Scripts Forums » Programming Languages » ASP.NET » read excel file using either oledbconnection or odbc


read excel file using either oledbconnection or odbc

Reply
  #1 (permalink)  
Old 11-26-05, 06:17 AM
aparna_rao aparna_rao is offline
New Member
 
Join Date: Nov 2005
Location: mumbai
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
read excel file using either oledbconnection or odbc

I am trying to read excel file from my asp.net page
i tried this code

dim con as oledbconnection
dim cmd as oledbcommand

dim str = "provider=microsoft.jet.oledb.4.0;data source= " & server.mappath("..\book1.xls") & ";" & "extended properties= excel 8.0"

con=new oledbconnection(str)
con.open

i have given range name in .xls sheet as book_range

cmd=new oledbcommand("select * from book_range",con)
datagrid1.datasource=cmd.executenonquery

the connection gets open but when it executes command object it gives me
error saying 'the file may be in use '

so please give me solution for this as early possible

and also i want to know can i read excel file using DSN if so pls give code

thanks
aparnarao
Reply With Quote
  #2 (permalink)  
Old 11-27-05, 06:41 AM
rrhodes's Avatar
rrhodes rrhodes is offline
Newbie Coder
 
Join Date: Jul 2005
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
I recently had good luck purchasing and using this product: http://www.csvreader.com/

Perhaps you can use CSV output instead of direct XLS files?

Best of luck,
__________________
Robert
Gee! Web Tools
Web Content Management / Internet Marketing modules including:
Page Editor - Calendar Manager - News Editor - Contact Organizer - Mail Wizard
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP syntax error stuckonaproject ASP 8 12-14-04 10:30 AM
Database file or object file is read only, w_inaim ASP 2 09-21-04 02:18 PM
Export to excel file asp traceMe ASP 2 08-01-04 09:07 PM
Excel document containing records, need to save as a text file to upload to mysql bearslife PHP 1 06-05-04 03:24 AM
Upload file to table so ONLY files tied to primary key are displayed in record? grafixDummy PHP 4 12-20-03 04:28 PM


All times are GMT -5. The time now is 01:08 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.