Mar 14th, 2001, 10:09 AM
I'm using a grid control (dbgrid32.ocx) along with intristic data control. As I understand I should be using the new versions of both data control and grid control (I think it's called OLE DB).
Can someone show me a sample of linking Access97 database to the new OLE DB grid through the new OLE DB data control?
Mar 14th, 2001, 11:08 AM
I am afraid that my attempt on making a database application also ran on the cliffs. But I do can give you a starting point, the simplified short basics.
First, place the grid control (simply call it grdMyGrid) and data control (datMyData) on your form (frmDB). First of all, you need to 'link' the grid control to the data control. This by using the property DataSource of our grdMyGrid. So, in your properties window, set the DataSource property to datMyData (you can select it from a list). Now the grid control is connected. The data control needs to know where to get his information. The control has a property for this: DatabaseName. When equal to the complete path of our *.mdb file, he knows where to get his information. Let's say it's located at C:\MyDB.mdb, put "C:\MyDB.mdb" in the DatabaseName property. Ok, done. Now, I will show you a little example of code that requests information out of the database with SQL. Of course, I'll assume that the database has a table named "Friends". It could be any name, as long as it's in the database .
Private Sub Form_Load()
datMyData.RecordSource = "select * from friends"
Now the grid control should show you all contents of the table Friends. The "select * from friends" is SQL (it says 'give me * (=everything) from the table called Friends'). I recommend you to learn more of this somewhere else, as I'm no expert in SQL. This is the simpelest example there is (when it worked of course, but I really hope so).
On the first line, the data control sets his SQL command in given property. Then, it refreshes on the second line, displaying every record of this table.
Tip: On the "*" you should give the column name. I chose to show every column, but let's say you want to show the column "Birthday", simply replace the "*" by "Birthday".)
I hope this will help with your problem,
Mar 14th, 2001, 11:52 AM
Thanks, but the new data control (ADODC) doesn't have a database name property.
Mar 14th, 2001, 11:55 AM
Click Here to Expand Forum to Full Width
Survey posted by VBForums.