What is .DBF, .MDX file?? How to open it to modify??
I have a file User.DBF, User.MDX but don't know how to open it to modify...
I have some research about the file extension.. but the result return is "Database IV"...
I try to use Visual Basic 6.0 to connect and open it to add new column but fail....
Code:
Dim foldername As String
foldername = "C:\Documents and Settings\Programmer\Desktop\Data"
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & foldername & ";Extended Properties=dBase IV;"
Conn.Execute ("ALTER TABLE User ADD TotalAccess char(255)")
Run-time error
Code:
Operation not supported on the table that contains data.
Re: What is .DBF, .MDX file?? How to open it to modify??
Try using a foxpro driver.
Re: What is .DBF, .MDX file?? How to open it to modify??
It's not "Database IV" ... it is "dBase IV" ... it's a database system, like FoxPro, Access, SQL Server, Oracle, etc. If you've got MDAC installed, odds are you've got what you need to read the file in. Try using a connection string something like this:
Code:
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\folder;Extended Properties=dBASE IV;User ID=Admin;Password=;
naturaly, the path to the file and the user ID, password will need to be changed.
-tg
Re: What is .DBF, .MDX file?? How to open it to modify??
but why I keep having the "Operation not supported on the table that contains data." run-time error when I try to add new column to the .DBF file..
I can open the database and retrieve the data properly using the following... just cannot add new column...
Code:
Dim foldername As String
foldername = "C:\Documents and Settings\Programmer\Desktop\Data"
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & foldername & ";Extended Properties=dBase IV;"
Dim sql as string
Dim rs as new ADODB.Recordset
sql="Select * FROM User"
rs.open sql, Conn
If rs.BOF = False Then
xxxxxx
xxxxxx
End If
rs.Close
Re: What is .DBF, .MDX file?? How to open it to modify??
How are you adding the column? Did you ensure that there are no locks on the table (or table is not in use by databound controls) when column is being added?
1 Attachment(s)
Re: What is .DBF, .MDX file?? How to open it to modify??
I attachment my DBF file...
I can update and delete record properly... only cannot alter add new column...
I don't wether the DBF file is lock or not...
Re: What is .DBF, .MDX file?? How to open it to modify??
I even use the foxpro driver..
Conn.Open "Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB=" & foldername & ";Exclusive=No; Collate=Machine;NULL=NO;DELETED=NO;BACKGROUNDFETCH=NO;"
but still the same...
Re: What is .DBF, .MDX file?? How to open it to modify??
it maybe a limitation of the driver.... once there is data in the table, the table cannot be altered... at least not by using this method. You may have to get a copuy of dBase IV or FoxPro to do the actual table alter.
-tg
Re: What is .DBF, .MDX file?? How to open it to modify??
I already try to delete all the User.dbf data... but still the same runtime error
Code:
"Operation not supported on the table that contains data."
if I try using the visual FoxPro driver.... I get the other runtime error...
Code:
Conn.Open "Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB=" & foldername & ";Exclusive=No; Collate=Machine;NULL=NO;DELETED=NO;BACKGROUNDFETCH=NO;"
Conn.Execute ("ALTER TABLE V53User ADD TotalAccess char(255)")
Runtime error
Code:
[Microsoft][ODBC Visual FoxPro Driver]Not a table.
Re: What is .DBF, .MDX file?? How to open it to modify??
Not a table error - Your use of Jet driver may have caused the table header record count info not to match with actual record count.
You might have to recreate the table (new table with added column) using foxpro and import data from the old table.
Re: What is .DBF, .MDX file?? How to open it to modify??
and when we say "with foxpro" we don't mean with the FoxPro driver... but with FoxPro itself...
-tg
Re: What is .DBF, .MDX file?? How to open it to modify??
I been use the Microsoft Visual FoxPro s/w to open the User.dbf... but it also prompt "Not a Table" error
1 Attachment(s)
Re: What is .DBF, .MDX file?? How to open it to modify??
I try to create my own MS Access (.mdb) file and the column ready...
but when I want to export it to DBase IV datatype... the MS Access keep prompt me the "Cannot define field more than once." error...
I try to remove the last four column and it work.... what's the problem???