
June 23rd, 2003, 05:21 PM
|
|
Registered User
|
|
Join Date: Jun 2003
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Opening an excel file
New to asp.net and having problem with this. I receive reports via email of training classes attended from outside providers that are excel files. These files are used to update licensee iffo in our SQL 2000 database. Presently I am opening the file to assure its formatted correctly then using the import ability of SQL 2000 to transform the file then run a stored procedure to load the data to update the appropriate tables. Effective but time consuming. My idea is to develope a asp.net page so that our licensing department could do this themselves. My idea is to open the file on an asp.net page so it can be quickly reviewed for proper format then save to the sql database and run the stored procedure when the user clicks a button. My problem is I cannot get the excel file to open in asp.net. I used some code I found on this site but I get the following server error,<br><br>The Microsoft Jet database engine cannot open the file ". It is already opened exclusivly by another user, or you need permission to view its data.<br><br>here is the code I'm using on a test page to try and get it working<br><br> Dim myDataset As New DataSet()<br> Dim strConn As String<br> strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=testexcel.xls;Extended Properties=""Excel 8.0;"""<br> Dim myData As New OleDbDataAdapter("SELECT * FROM [Sheet1$]", strConn)<br> myData.TableMappings.Add("Table", "ExcelTest")<br> myData.Fill(myDataset)<br> DataGrid1.DataSource = myDataset.Tables(0).DefaultView<br> DataGrid1.DataBind()<br><br>presently the test file is located in the solution but my goal is to open it from the users desktop.<br><br>Any help is greatly appreciated, or any code to open from a tab deliminated file would also work as the providers could save the excel file that way easily. If I make it to hard for the small providers it will be dificult to collect the data.
|