Thread: how to read/write to Microsoft Access MDB file?

  1. #1
    Registered User
    Join Date
    Aug 2011
    Posts
    6

    how to read/write to Microsoft Access MDB file?

    Hi,

    I want to write a test program in C, that will allow me to do the following:

    Read and write to an Access 2003 mdb file, named c:\test\db.mdb

    I simply want to write these 4 values into a table named "data" inside the file c:\test\db.mdb

    123A 10.50 5.75 20.2

    Afterwards, I want to read the whole table named "data" from that c:\test\db.mdb file (it always will only have 4 fields), and print its contents to the screen , that may look something like this:

    ID X Y Length
    100 6.60 2.15 10.5
    105b 15.75 5.00 18.6
    123A 10.50 5.75 20.2


    If you know how to do this, or have a similar C program that will solve this problem, please post. Thank you.

  2. #2
    Registered User
    Join Date
    May 2011
    Location
    Around 8.3 light-minutes from the Sun
    Posts
    1,949
    This isn't an easy task, and often is not worth the effort. If you want to automate Access just look into using VBA in making your solution. However, if you want to do this in C your best bet would be to look for 3rd party libraries that provide the functionality you want to interface with Access.

    All of Microsoft Office exposes its methods through COM interfaces. If you actually want to do this without any 3rd party support look at MSDN for articles which explain the COM API for Access.
    Quote Originally Posted by anduril462 View Post
    Now, please, for the love of all things good and holy, think about what you're doing! Don't just run around willy-nilly, coding like a drunk two-year-old....
    Quote Originally Posted by quzah View Post
    ..... Just don't be surprised when I say you aren't using standard C anymore, and as such,are off in your own little universe that I will completely disregard.
    Warning: Some or all of my posted code may be non-standard and as such should not be used and in no case looked at.

  3. #3
    Registered User
    Join Date
    May 2009
    Posts
    4,183

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 07-18-2009, 01:17 PM
  2. Read/Write Access on Apache
    By Mario F. in forum Tech Board
    Replies: 2
    Last Post: 04-04-2008, 03:04 AM
  3. Read a Microsoft LNK file using C?
    By winkerbean in forum C Programming
    Replies: 2
    Last Post: 02-21-2008, 05:47 PM
  4. How to access excel sheet with C program(open,read,write)
    By jaininaveen in forum C Programming
    Replies: 4
    Last Post: 01-29-2006, 11:17 AM
  5. read and write to file
    By staticalloc in forum C Programming
    Replies: 17
    Last Post: 09-20-2004, 05:57 PM