By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,852 Members | 888 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,852 IT Pros & Developers. It's quick & easy.

Cannot access Excel sheet data from Visual Basic.Net

P: n/a
Hi Developers,

I am trying to access an Excel data file through a VB.Net application.
I have the following code:

=================================== VB.Net Code ===================
Dim sSqlString = ""
Dim rCount As Integer = 0
Dim sDataSet As New DataSet()
sSqlString = "Select * From [Sheet1$]"
Dim sConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + "E:\Visual Basic.NET\DataOne" + ";Extended Properties=Excel 8.0;HDR=YES;"
Dim dbConn As New OleDbConnection(sConnString)
Dim sCommandSelect As New OleDbCommand(sSqlString, dbConn)

Try
sCommandSelect.Connection.Open()
Catch ex As OleDbException
MessageBox.Show(ex.Message, ex.ErrorCode)
End Try
================================================== =======

Each time I hit the statement "sCommandSelect.Connection.Open()" above, I got the following error:

"Could not find installable ISAM"

Excel 2002 and Visual Studio.Net are both fully and successfully installed.
Anyone knows why it would not make work?

Sincerely,
Omar
P.S. Please cc your reply to my email: oy****@yahoo.com

Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi,

You get that error if when ado.net is unable to open the data
source. Shouldn't your data source be something like this "E:\Visual
Basic.NET\DataOne.xls" + "; not "E:\Visual Basic.NET\DataOne" + ";

Ken
-------------------------------

"Omar" <oy****@yahoo.com> wrote in message
news:F4**********************************@microsof t.com...
Hi Developers,

I am trying to access an Excel data file through a VB.Net application.
I have the following code:

=================================== VB.Net Code ===================
Dim sSqlString = ""
Dim rCount As Integer = 0
Dim sDataSet As New DataSet()
sSqlString = "Select * From [Sheet1$]"
Dim sConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + "E:\Visual Basic.NET\DataOne" + ";Extended Properties=Excel
8.0;HDR=YES;" Dim dbConn As New OleDbConnection(sConnString)
Dim sCommandSelect As New OleDbCommand(sSqlString, dbConn)

Try
sCommandSelect.Connection.Open()
Catch ex As OleDbException
MessageBox.Show(ex.Message, ex.ErrorCode)
End Try
================================================== =======

Each time I hit the statement "sCommandSelect.Connection.Open()" above, I got the following error:
"Could not find installable ISAM"

Excel 2002 and Visual Studio.Net are both fully and successfully installed. Anyone knows why it would not make work?

Sincerely,
Omar
P.S. Please cc your reply to my email: oy****@yahoo.com

Nov 20 '05 #2

P: n/a
i don't know
-----Original Message-----
Hi,

You get that error if when ado.net is unable to open the datasource. Shouldn't your data source be something like this "E:\VisualBasic.NET\DataOne.xls" + "; not "E:\Visual Basic.NET\DataOne" + ";
Ken
-------------------------------

"Omar" <oy****@yahoo.com> wrote in message
news:F4E4E2D8-CB27-44E2-90FB- 5C**********@microsoft.com...
Hi Developers,

I am trying to access an Excel data file through a VB.Net application. I have the following code:

=================================== VB.Net Code =================== Dim sSqlString = ""
Dim rCount As Integer = 0
Dim sDataSet As New DataSet()
sSqlString = "Select * From [Sheet1$]"
Dim sConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;DataSource=" + "E:\Visual Basic.NET\DataOne" + ";Extended Properties=Excel8.0;HDR=YES;"
Dim dbConn As New OleDbConnection
(sConnString) Dim sCommandSelect As New OleDbCommand (sSqlString, dbConn)
Try
sCommandSelect.Connection.Open()
Catch ex As OleDbException
MessageBox.Show(ex.Message, ex.ErrorCode)
End Try
============================================
=============
Each time I hit the statement "sCommandSelect.Connection.Open()" above, Igot the following error:

"Could not find installable ISAM"

Excel 2002 and Visual Studio.Net are both fully and
successfullyinstalled.
Anyone knows why it would not make work?

Sincerely,
Omar
P.S. Please cc your reply to my email:

oy****@yahoo.com

.

Nov 20 '05 #3

P: n/a
On Thu, 23 Oct 2003 23:21:05 -0700, "Omar" <oy****@yahoo.com> wrote:

Hi Developers,

I am trying to access an Excel data file through a VB.Net application.
I have the following code:

=================================== VB.Net Code ===================
Dim sSqlString = ""
Dim rCount As Integer = 0
Dim sDataSet As New DataSet()
sSqlString = "Select * From [Sheet1$]"
Dim sConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + "E:\Visual Basic.NET\DataOne" + ";Extended Properties=Excel 8.0;HDR=YES;"
Dim dbConn As New OleDbConnection(sConnString)
Dim sCommandSelect As New OleDbCommand(sSqlString, dbConn)

Try
sCommandSelect.Connection.Open()
Catch ex As OleDbException
MessageBox.Show(ex.Message, ex.ErrorCode)
End Try
================================================== =======

Each time I hit the statement "sCommandSelect.Connection.Open()" above, I got the following error:

"Could not find installable ISAM"

Excel 2002 and Visual Studio.Net are both fully and successfully installed.
Anyone knows why it would not make work?

Your connection string syntax is bad. It gets a little tricky when you have additional Extented
Properties and you also need to specify the Excel filename:

"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=E:\Visual Basic.NET\DataOne\ExcelFileName.xls;" & _
"Extended Properties=""Excel 8.0;HDR=Yes"""
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)
Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.