472,128 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Cannot access Excel sheet data from Visual Basic.Net

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
3 2858
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
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
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.

Similar topics

41 posts views Thread by Ruby Tuesday | last post: by
4 posts views Thread by Anthony Cuttitta Jr. | last post: by
1 post views Thread by http://www.visual-basic-data-mining.net/forum | last post: by
12 posts views Thread by elziko | last post: by
5 posts views Thread by mark | last post: by

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.