473,405 Members | 2,287 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,405 software developers and data experts.

How do I open a dbf table in VB Express?

I am trying to open a table in dbf format using VB
Express. There seems to be no explicit provider
alternative. A few of the providers reports that
"Test connection succeeded.", but when I try to
use the connection I get the message "Unable to
connect to database. This feature is not supported
by M$ VB Express."

Is this a dead end or is there a workaround? I
need to read the file and would be very pleased if
I could write to it as well.

Thanks in advance for the answers.

Erik Edlund
Jul 21 '05 #1
3 2860
Huh, Should be a system.data thing, not a VB Express thing. ISAMS can an
ODBC driver but I find it faster and easier to use the Jet ISAM drivers.

I used Access to export the Biblio.mdb Authors table. Then opened VB
Express and started a new forms project.

Added a reference to System.Data.Dll and System.XML.dll.

Then added a datagridview, named it "grid1" and a button to the form.

At the top of the form I added Imports System.Data & Imports
System.Data.Oledb

In the button click I added:

Dim cn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; " & _
"Data Source=C:\testarea;" & _
"Extended Properties=""dBase III""")

Dim ds As New DataSet
Dim da As New OleDbDataAdapter("Select * from Authors", cn)
Try
cn.Open()
da.Fill(ds)
grid1.DataSource = ds.Tables(0)
Catch ex As Exception
MsgBox(ex.ToString)
End Try

And there it was. Remember that for xbase files the folder where the files
are is the "Database" so in the above, my dbf and ndx files are in the
folder "C:\testarea" and the "Tables" are the dbf files themselves. Also
remember that the ISAM type name has to be exact in the connection string so
it's "dBase III" (with a space) for dbase 3, dBase IV for 4 and so on.

Hope that helps.

Robert Smith
Kirkland, WA
www.smithvoice.com

"Erik Edlund" <er**@norrsken.nu> wrote in message
news:MV******************@newsb.telia.net...
I am trying to open a table in dbf format using VB Express. There seems to
be no explicit provider alternative. A few of the providers reports that
"Test connection succeeded.", but when I try to use the connection I get
the message "Unable to connect to database. This feature is not supported
by M$ VB Express."

Is this a dead end or is there a workaround? I need to read the file and
would be very pleased if I could write to it as well.

Thanks in advance for the answers.

Erik Edlund

Jul 21 '05 #2
Thanks Robert!

Your advice made all the difference. But I really
don't see why Microsoft think that I should
understand that the Jet engine is the number one
choice for opening .dbf files.

I experienced further problems when I was trying
to add the Imports System.Data & Imports
System.Data.Oledb. I have used these in other
projects without problems, but in this case it was
impossible. Although I could see it in the Object
Browser I could not add it to the code without
generating an error message. The Intellisense(?)
wouldn't even show the .Data alternative to me.

I solved(?) the problem by placing a DataConnector
and a DataSet on my form, without using them at
all! Suddenly everything worked and strengthened
by this experience I removed them and it still worked!

best regards / Erik Edlund
smith wrote:
Huh, Should be a system.data thing, not a VB Express thing. ISAMS can an
ODBC driver but I find it faster and easier to use the Jet ISAM drivers.

I used Access to export the Biblio.mdb Authors table. Then opened VB
Express and started a new forms project.

Added a reference to System.Data.Dll and System.XML.dll.

Then added a datagridview, named it "grid1" and a button to the form.

At the top of the form I added Imports System.Data & Imports
System.Data.Oledb

In the button click I added:

Dim cn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; " & _
"Data Source=C:\testarea;" & _
"Extended Properties=""dBase III""")

Dim ds As New DataSet
Dim da As New OleDbDataAdapter("Select * from Authors", cn)
Try
cn.Open()
da.Fill(ds)
grid1.DataSource = ds.Tables(0)
Catch ex As Exception
MsgBox(ex.ToString)
End Try

And there it was. Remember that for xbase files the folder where the files
are is the "Database" so in the above, my dbf and ndx files are in the
folder "C:\testarea" and the "Tables" are the dbf files themselves. Also
remember that the ISAM type name has to be exact in the connection string so
it's "dBase III" (with a space) for dbase 3, dBase IV for 4 and so on.

Hope that helps.

Robert Smith
Kirkland, WA
www.smithvoice.com

"Erik Edlund" <er**@norrsken.nu> wrote in message
news:MV******************@newsb.telia.net...
I am trying to open a table in dbf format using VB Express. There seems to
be no explicit provider alternative. A few of the providers reports that
"Test connection succeeded.", but when I try to use the connection I get
the message "Unable to connect to database. This feature is not supported
by M$ VB Express."

Is this a dead end or is there a workaround? I need to read the file and
would be very pleased if I could write to it as well.

Thanks in advance for the answers.

Erik Edlund


Jul 21 '05 #3
Huh. That;'s interesting about the problems of adding the references in VB
Express. Maybe you ( or I?) are running different versions, there was the
original Express and then there was the October update .. and I don't know
if I updated mine or not.

In any case, you figured out how to get the reference and that means you're
ready to help out others who hit the problem - I will definitely remember
your trick, and I thank you for it. That's what brick walls are for :)

I use the Jet engine for ISAM connectivity because it's always just been
faster for me than dealing with ODBC, I don't know if it's Microsoft's "best
practice" route or not. The thing is that the Jet drivers are usually on
most machines by default... matter of fact, I did that test using an XP box
that has nothing on it but VB Express, Norton Antivirus, Flash MX and Flash
MX 2004 and I don't think that the Jet support came from Macromedia ;-)

Many of us know what it's like to support xBase these days but it sure is
better than that dark time when Redmond removed the xBase support from VB
completely (http://www.smithvoice.com/xbse2k.htm ), right?

All the best.

-smith
"Erik Edlund" <er**@norrsken.nu> wrote in message
news:ft*********************@newsc.telia.net...
Thanks Robert!

Your advice made all the difference. But I really don't see why Microsoft
think that I should understand that the Jet engine is the number one
choice for opening .dbf files.

I experienced further problems when I was trying to add the Imports
System.Data & Imports System.Data.Oledb. I have used these in other
projects without problems, but in this case it was impossible. Although I
could see it in the Object Browser I could not add it to the code without
generating an error message. The Intellisense(?) wouldn't even show the
.Data alternative to me.

I solved(?) the problem by placing a DataConnector and a DataSet on my
form, without using them at all! Suddenly everything worked and
strengthened by this experience I removed them and it still worked!

best regards / Erik Edlund

Jul 21 '05 #4

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

Similar topics

61
by: Toby Austin | last post by:
I'm trying to replace <table>s with <div>s as much as possible. However, I can't figure out how to do the following… <table> <tr> <td valign="top" width="100%">some data that will...
2
by: MLH | last post by:
I routinely save failure notices from mail servers bouncing mail back to me that I sent with invalid address. I would like to write an access procedure in my contacts database that would open the...
2
by: Daniel | last post by:
I use an Access database to basically take data exports, import them, manipulate the data, and then turn them into exportable reports. I do this using numerous macros, and queries to get the data...
4
by: PerryC | last post by:
All, How to ensure SendObject open Outlook and Not Outlook Express? Most pc here at work will default to open OL but on one pc, it open up OL Express. How to fix this in the code? P.S.: I...
3
by: Erik Edlund | last post by:
I am trying to open a table in dbf format using VB Express. There seems to be no explicit provider alternative. A few of the providers reports that "Test connection succeeded.", but when I try to...
6
by: Brad | last post by:
I have a win2003 server workstation with multiple webs, each web has it's own ip address. In VS2005, if I select to open an existing web site, select Local IIS, the dialog correctly displays a...
7
by: slitvinov | last post by:
I am learning Relax NG. The problem is that I cannot figure out how to make a schema for a table. In my case I would like to make a table with any name of child elements (columns) but columns...
4
imrosie
by: imrosie | last post by:
Hello, I need help. I have a 'NotInlist' routine that appears to givbe me 2 entries of the same new customer. It first adds the name to the list, then when I fill in other customer data (i.e.,...
10
by: AAaron123 | last post by:
I want to create a database with one table on the host. I can't user SQL Server Management Studio to do it so I guess I have to do it programmatically. I have in mind that in the session start...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.