Thread: Ms Access & C++builder4

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    29

    Question Ms Access & C++builder4

    Hello Everybody
    I'm reposting this just in case that someone that may be able to help may have missed it. (no disrespect intended)
    I was wondering can anyone help me. I want to access tables in MS Access through C++Builder. I know how to do it in VB and I was wondering if it is the same?
    If you know I'd much appreciate it.
    Thanks in advance,
    Colin

  2. #2
    Unregistered
    Guest
    excellent question, This isn't an answer but i hope someone can answer, how to access a database with C++

  3. #3
    Registered User
    Join Date
    Mar 2002
    Posts
    2

    Wink

    It's not quite as simple as it is in VB, but it's not too bad. Now, I use Builder 5, not 4, but it's probably the same.

    You must go through control panel and click "ODBC Data Sources". Under the User DSN tab, choose Add. Then pick the MS Access driver. Then you'll want to type in a descriptive name where it says "Data Source Name" because this will serve as your alias. Next, choose Select and get the path where your Access db is located. Click OK and you're done. When you try to use an Access db, it will probably prompt you for a username and password (at least Builder 5 does). The deafult is "admin" for the username with no password. You can choose your own password and username under the Advanced button where to selected the path of your db. Now you connect to the Access db the same way you would connect to Paradox or any other in Builder.

    Just in case you're not familiar with connecting to any DBs in Builder, here's the steps. I would place my table and datasource in a data module. Select New from file menu and choose Data Module. Under the data access tab where all the components are located, drop a table and datasource in the data module. With the focus on your table component, click beside "DatabaseName" in the Object Inspector and you'll get a drop down list. From here, pick the descriptive alias you typed in earlier. Now go down to "TableName" and pick the table from your Access database that you want to work with. Now click on the data source component to give it focus. Where is says "DataSet" in the Object Inspector, choose the name of the table component. Of course, descriptive names for both the table and data source component are recommended for coding purposes. ALso, for every table you wish to use in your program, you must have a separate table and datasource component.

    So, there you are. You probably knew all of the stuff about connecting to the DB with the table and datasource. If not, then you may not know how to code or connect other components on your forms to the tables. If this is the case, let me know and I will help. Also, I keep forgetting you are using ver 4.0 and not 5.0, so I hope everything I told you holds true in 4.0. Good luck!!

  4. #4
    Registered User
    Join Date
    Jan 2002
    Posts
    29
    thanks a million,
    I'm am trying it out tonight on a small table to see if i can do it.
    I will let you know how it works out
    Thanks again,
    Colin

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Speed test result
    By audinue in forum C Programming
    Replies: 4
    Last Post: 07-07-2008, 05:18 AM
  2. Error connecting from Dev C++ to MS Access Database
    By Sridar in forum C++ Programming
    Replies: 0
    Last Post: 04-15-2006, 06:09 PM
  3. Ping
    By ZakkWylde969 in forum Tech Board
    Replies: 5
    Last Post: 09-23-2003, 12:28 PM
  4. The Timing is incorret
    By Drew in forum C++ Programming
    Replies: 5
    Last Post: 08-28-2003, 04:57 PM
  5. using DAO without MS Access installed
    By zMan in forum Windows Programming
    Replies: 2
    Last Post: 02-20-2002, 03:14 PM