QAxObject and sql



  • Hi. I want to query an sql server using QAxObject.
    Using this line of code
    @QAXOConn->dynamicCall("Open("Provider=SQLOLEDB.1;Integrated Security=SSPI;Initial Catalog=Inaz;Data Source=SERVER02")");@
    I can connect to a Sql Server using Ado.
    Now How can I run a query as
    select * from table01
    ?


  • Lifetime Qt Champion

    Hi,

    I can't answer that one but I was just wondering, why not use Qt's SQL module ?



  • I need to use ADO because I will have to manage a unknown type of database, maybe will be MySql, DBII, Sql Server..
    The program will be installed in a lot of customers, each one with a different database. By ADO you can connect without use ODBC at a lot types of databases.



  • Only a bit to the solution!
    With these lines of code

    @ QAXOConn->dynamicCall("Open("Provider=SQLOLEDB.1;Integrated Security=SSPI;Initial Catalog=Inaz;Data Source=SERVER02")");
    QAxObject *QAXORecordSet= QAXOConn->querySubObject("Execute("select column01 from table01")");
    while(!QAXORecordSet->property("EOF").toBool()) {
    QAXORecordSet->dynamicCall("MoveNext()");
    }@

    I can execute a query and hop to the the next record but the question is:
    How can I get the column value?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.