Results 1 to 4 of 4

Thread: how to connect to a microsoft access database?

  1. #1
    Join Date
    Feb 2008
    Posts
    154
    Thanks
    12
    Qt products
    Qt4
    Platforms
    Windows

    Question how to connect to a microsoft access database?

    hello evrybody,
    i am writing a program that should connect to a microsoft access
    what should i do to connect to such database?
    note that i wrote this code:

    Qt Code:
    1. QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
    2. db.setDatabaseName("DRIVER={Microsoft Access Driver (*.mdb)};FIL={MS Access};DBQ=book.mdb");
    3. if(db.open())
    4. QMessageBox::warning(this, "opened","successful");
    To copy to clipboard, switch view to plain text mode 

    and every thing works fine and the program is compiled successfully but
    when i execute the program the message that indicate to the database is opend does not appear it means that the database can not be opened
    should i do some thing to the windows OS or install some thing to let me
    connect to ms Access database???
    thank you...
    Last edited by jpn; 7th March 2008 at 07:34. Reason: missing [code] tags

  2. #2
    Join Date
    Feb 2008
    Posts
    154
    Thanks
    12
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how to connect to a microsoft access database?

    i executed this function
    Qt Code:
    1. QSqlDatabase::isDriverAvailable("QODBC")
    To copy to clipboard, switch view to plain text mode 
    and it returns false
    it means that the driver does not exist!!!
    Last edited by jpn; 7th March 2008 at 08:19. Reason: missing [code] tags

  3. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: how to connect to a microsoft access database?

    J-P Nurmi

  4. The following user says thank you to jpn for this useful post:

    mismael85 (7th March 2008)

  5. #4
    Join Date
    Feb 2008
    Posts
    154
    Thanks
    12
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how to connect to a microsoft access database?

    i built it, thank you i will keep going on my project . i am sure i will face some problems
    and i will ask you again .
    please be patient with me.
    excuse me.

Similar Threads

  1. what is the driver type for an access database?
    By mismael85 in forum Qt Programming
    Replies: 1
    Last Post: 29th February 2008, 11:04
  2. connecting QT3 with MS Access database
    By raghvendramisra in forum Qt Programming
    Replies: 1
    Last Post: 2nd February 2007, 10:48
  3. Database access issue
    By Gayathri in forum Newbie
    Replies: 3
    Last Post: 23rd November 2006, 08:41
  4. Database access from Qt
    By nimmyj in forum Qt Programming
    Replies: 1
    Last Post: 23rd November 2006, 07:51
  5. Replies: 5
    Last Post: 28th August 2006, 15:36

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.