Last post Apr 02, 2018 05:02 AM by lappel
Mar 05, 2018 09:31 AM|dudirudiana|LINK
i have a program with asp.net programming, in my program there code which used code of convert excel to dataset.
when program have to finish, and i running in my local is succesfull but i running in windows server is failed.
i don't know what happen, error massage like this "cannot find table 0."
my opinion that's error is there on connection, Provider=Microsoft.JET.OLEDB.4.0;Data Source=" & SaveLocation & ";Extended Properties=""Excel 8.0;HDR=Yes""; not support in windows server.
can help me anyone, give me solution for my program.
Mar 05, 2018 09:53 AM|Dave_Winchester|LINK
Are you sure you have permissions to read/write to that file location?
Also, just want to check - are you sure your connection string is correct:
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\MyExcel.xls;Extended Properties="Excel 8.0;HDR=Yes;IMEX=1"
Mar 05, 2018 09:55 AM|dudirudiana|LINK
iam sure, thats file location has been fix. Error not there, but file location have to read for convert to dataset
Mar 05, 2018 10:00 AM|PatriceSc|LINK
On which line does it happen? I would rather expect that on a DataSet.Tables statement. Make sure you don't ignore a previous exception which would explian why no table at all is read.
Mar 05, 2018 10:28 AM|Dave_Winchester|LINK
Try, something like this.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim MyConnection As System.Data.OleDb.OleDbConnection
Dim DtSet As System.Data.DataSet
Dim MyCommand As System.Data.OleDb.OleDbDataAdapter
MyConnection = New System.Data.OleDb.OleDbConnection ("provider=Microsoft.Jet.OLEDB.4.0; Data Source='c:\testfile.xls'; Extended Properties=Excel 8.0;")
MyCommand = New System.Data.OleDb.OleDbDataAdapter ("select * from [Sheet1$]", MyConnection)
DtSet = New System.Data.DataSet
DataGridView1.DataSource = DtSet.Tables(0)
Catch ex As Exception
Apr 02, 2018 05:02 AM|lappel|LINK
please try this,
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\myFolder\myOldExcelFile.xls;Extended Properties="Excel 8.0;HDR=YES";
i hope it's work.