Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Microsoft sql db access gives error in opening..

Microsoft sql db access gives error in opening..

Scheduled Pinned Locked Moved Mobile and Embedded
2 Posts 2 Posters 906 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Abin
    wrote on last edited by
    #1

    Hi,
    I wrote a program to access Microsoft sql database. It works fine in desktop. But when I run same program in android device I'm getting error:
    bq. 04-09 06:17:41.784: W/Qt(1240): kernel\qsqlquery.cpp:368 (bool QSqlQuery::exec(const QString&)): QSqlQuery::exec: database not open

    Here is my code:

    @ QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
    db.setDatabaseName("Driver={SQL Server};Server=192.168.1.3;Database=sms_exp;");
    db.setUserName("sa");
    db.setPassword("xxxxxyy");
    if(!db.open())
    {
    qDebug ("Error");
    }
    else
    {
    qDebug ("OK");
    }

    QSqlQuery query (db);
    query.exec("SELECT item_code, item_des FROM prod_mast WHERE item_code = 0100000210");
    while (query.next())
    {
            QString name1 = query.value(0).toString();
            QString name2 = query.value(1).toString();
            qDebug (qPrintable(name1));
            qDebug (qPrintable(name2));
       }
    
    db.close();@
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      AFAIK there's no ODBC c++ client library for android (I could be wrong and be happy to be proven so).

      If you have one you need to build the plugin

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved