PDA

Click to See Complete Forum and Search --> : data control


Harry
Aug 8th, 1999, 09:33 PM
I'm trying to populate a DBGrid with a dbf file but I'm having trouble. I'm using a data control to connect to the database. In the DatabaseName property I put the path of the dbf file but I can't seem to set the Recordsource property. Is it possible to connect to a non mdb database?? If this is possible can you please show me how. Please include some sample code. Thank-you!
--


------------------

MGC
Aug 9th, 1999, 11:18 AM
I'm not sure of the type and version of database you are trying to connect to but with an extension of .dbf I assume if must be FoxPro or DBase.
You should be able to connect to these with no problems as follows: 1 - Set the connect property on the data control to either DBase or Foxpro. 2 - Set the databasename property to the path of the folder containing your .dbf tables. Set the recordsource property to the name of the table with out the .dbf extension (you can replace this with select queries and so on later once you have your data coming through). 3 - Next ensure you have bound your grid to the data control.

NOTE
1 - The data field property for each column on a DBGrid is case sensitive, these names must match the case of your fields names exactly else you will not see any data coming through.

2 - When you delete a record in DBase or FoxPro the record is not actually removed but simply flagged as deleted. There are settings to tell vb whether to show these deleted records or not. This is set in the registry or an ini file depending on vb version.

3 - If your going to store many records in your tables then you need to tell VB about the indexes - See the Accessing Data in External Databases sections of the VB help file.