Does anyone know how to open dbase files that have different file extensions? We are creating a program that will open and read dbase files and post the information to a database on the internet.
The program that is exporting these dbf files with different extensions is based on very old technology but is the standard throughout the entire collision industry and is the ONLY format collision estimating software uses and exports.
For each job it creates 15 dbase files with different information in them. Instead of making files with different names and .dbf extensions the people who developed the industry standards decided it would be better to name them all the same name with different extensions.
Example:
123456.env
123456.ad1
123456.veh
123456.tot
Basically I need a connection string that will work in visual studio 2005, programming language C#, and open .dbf files with different file extensions.
keep getting the error filename.extension isn't a valid name.
Any help is greatly appreciated!
There is an article on it at microsoft support but it is very old. replacing the # sign didn't work.
Here is the article:
APPLIES TO
• Microsoft Visual Basic 3.0 Professional Edition
The standard file extension used by dBASE for tables is .DBF. In Visual Basic version 3.0 using the dBASE installable ISAMs, you can open a table by specifying the file name without this extension because the dBASE installable ISAM assumes the extension to be .DBF by default. If you specify the extension <filename>.<extension>, the dBASE installable ISAM will not recognize it and will give you the following error message:
<filename>.<extension> isn't a valid name.
To open a dBASE table file that has a non-standard file extension, specify the table name as <filename>#<extension>. The dBASE installable ISAM interprets the pound sign (#) in the table name as a period and opens the dBASE table.
Back to the top
Example
The following code example demonstrates how to open a dBASE table file that has a non-standard file extension (AUTHORS.OLD) and print the first field of all records in the table to the form. The following example assumes that you have a dBASE III table with a file name of AUTHORS.OLD located in the C:\DBASEIII\OLDBOOKS directory. You may need to modify the example and create a dBASE III database with a table called AUTHORS.OLD in order for it to work correctly.
1. Start Visual Basic or from the File menu, choose New Project (ALT, F, N) if Visual Basic is already running. Form1 is created by default.
2. Add a Command Button (Command1) to Form1.
3. Add the following code to the Click event of Command1: Sub Command1_Click()
Dim db As Database
Dim OldAuthors As Table
Connect$ = "dBASE III" ' Specify database type
dbName$ = "C:\DBASEIII\OLDBOOKS" ' Specify database directory
Set db = OpenDatabase(dbName$, False, False, Connect$)
Set OldAuthors = db.OpenTable("Authors#Old") ' Open table
While Not OldAuthors.EOF
Print OldAuthors(0) ' Print field(0) to the form
OldAuthors.MoveNext ' for all records.
Wend
OldAuthors.Close
db.Close
End Sub
4. Run the example.
5. Click the Command1 button.
APPLIES TO
• Microsoft Visual Basic 3.0 Professional Edition
The program that is exporting these dbf files with different extensions is based on very old technology but is the standard throughout the entire collision industry and is the ONLY format collision estimating software uses and exports.
For each job it creates 15 dbase files with different information in them. Instead of making files with different names and .dbf extensions the people who developed the industry standards decided it would be better to name them all the same name with different extensions.
Example:
123456.env
123456.ad1
123456.veh
123456.tot
Basically I need a connection string that will work in visual studio 2005, programming language C#, and open .dbf files with different file extensions.
keep getting the error filename.extension isn't a valid name.
Any help is greatly appreciated!
There is an article on it at microsoft support but it is very old. replacing the # sign didn't work.
Here is the article:
APPLIES TO
• Microsoft Visual Basic 3.0 Professional Edition
The standard file extension used by dBASE for tables is .DBF. In Visual Basic version 3.0 using the dBASE installable ISAMs, you can open a table by specifying the file name without this extension because the dBASE installable ISAM assumes the extension to be .DBF by default. If you specify the extension <filename>.<extension>, the dBASE installable ISAM will not recognize it and will give you the following error message:
<filename>.<extension> isn't a valid name.
To open a dBASE table file that has a non-standard file extension, specify the table name as <filename>#<extension>. The dBASE installable ISAM interprets the pound sign (#) in the table name as a period and opens the dBASE table.
Back to the top
Example
The following code example demonstrates how to open a dBASE table file that has a non-standard file extension (AUTHORS.OLD) and print the first field of all records in the table to the form. The following example assumes that you have a dBASE III table with a file name of AUTHORS.OLD located in the C:\DBASEIII\OLDBOOKS directory. You may need to modify the example and create a dBASE III database with a table called AUTHORS.OLD in order for it to work correctly.
1. Start Visual Basic or from the File menu, choose New Project (ALT, F, N) if Visual Basic is already running. Form1 is created by default.
2. Add a Command Button (Command1) to Form1.
3. Add the following code to the Click event of Command1: Sub Command1_Click()
Dim db As Database
Dim OldAuthors As Table
Connect$ = "dBASE III" ' Specify database type
dbName$ = "C:\DBASEIII\OLDBOOKS" ' Specify database directory
Set db = OpenDatabase(dbName$, False, False, Connect$)
Set OldAuthors = db.OpenTable("Authors#Old") ' Open table
While Not OldAuthors.EOF
Print OldAuthors(0) ' Print field(0) to the form
OldAuthors.MoveNext ' for all records.
Wend
OldAuthors.Close
db.Close
End Sub
4. Run the example.
5. Click the Command1 button.
APPLIES TO
• Microsoft Visual Basic 3.0 Professional Edition