473,320 Members | 1,978 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

load excel into dataset from asp.net page

Hi there,
I load an excel file from an asp.net page and try to read it into a dataset.
The problem is that it tells me: Database or object is read-only
It only needs to be read only. Here is the code. Could someone please advice
me what I am doing wrong. Thank you Chris
(FileExcel is the input field)

System.IO.Stream sio;
sio = FileExcel.PostedFile.InputStream;
string sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data
Source=" + sio + ";" + "Extended Properties=Excel 8.0;";
OleDbConnection objConn = new OleDbConnection(sConnectionString);
objConn.Open();
OleDbCommand objCmdSelect = new OleDbCommand("SELECT * FROM [Sheet1$]",
objConn);
OleDbDataAdapter objAdapter1 = new OleDbDataAdapter();
objAdapter1.SelectCommand = objCmdSelect;
DataSet dsExcel = new DataSet();
objAdapter1.Fill(dsExcel);
objConn.Close();
Nov 17 '05 #1
1 7032
Chris,

Why you use that SIO, in the connection you have just to set the path to the
excel file.

I hope this helps,

Cor
Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Shabam | last post by:
A web application of mine developed using C# + MS SQL runs fine normally. However when I stress test it with a load testing software (using about 60 simultaneous users) some instances start...
9
by: Paul | last post by:
Hi all Arggghhh........... The problem.....I want the user to be able to create an excel document and name particular cells in the document where they want the data to be placed and then save...
9
by: John Kirksey | last post by:
I have a page that uses an in-place editable DataGrid that supports sorting and paging. EnableViewState is turned ON. At the top of the page are several search fields that allow the user to filter...
3
by: Schultz | last post by:
I would like to know if it is possible to import data from MS Excel 2000 to a dataset using asp.net. The excel file would need to be uploaded to the server from a web page first, before the loaded...
2
by: TM | last post by:
I have an Excel sheet where I setup my needed formatting, page settings, ect, and would like to take my data from a datagrid and paste it into the excel file and print the excel file. Any idea...
1
by: Vanajakshi Pidatala | last post by:
Hello, I am trying to show data in dataset in to an excel sheet(ASP.NET/VB.NET). I AM DOING THIS ON SERVER(IIS SERVER) WHICH HAS EXCEL VERSION 9. I COULD ADD REFERENCE TO EXCEL VERSION 9 AND...
1
by: Andrew Nav | last post by:
I dragged a table from a datasource on to my web form and the GridView cpntrol was created. I turned on paging, and Edit and Delete buttons. I ran the app and everything worked great - not a...
2
by: Mad Scientist Jr | last post by:
>From an asp.net web page I want the user to open the results of a SQL query in Excel, as automatically as possible (ie not having to loop through columns, rows, in code). For this,...
1
by: =?Utf-8?B?TGFtaXM=?= | last post by:
HI, I am doing an aspx application and need to let my users be able to edit the information in my database by the page. My first Idea was to let them export the information to an excel file at...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.