Creating and Accessing MS SQL server using QODBC



  • I am trying to create a '.mdf' file using QSql .

    QSqlDatabase db = QSqlDatabase::addDatabase("QODBC3");
    db.setHostName( "DRIVER={SQL Server};SERVER=(localhost);DATABASE=OpenFire;UID=;PWD=;" );
    bool bOk = db.open();
    err = db.lastError();

    There is no error and also the bOK is false. I tried both QODBC and QODBC3 drivers.

    And how to create an mdf file from QT.



  • From stackoverflow:

    A .MDF file is “typically” a SQL Server data file however it is important to note that it does NOT have to be.
    
    This is because .MDF is nothing more than a recommended/preferred notation but the extension itself does not actually dictate the file type.
    
    To illustrate this, if someone wanted to create their primary data file with an extension of .gbn they could go ahead and do so without issue.
    
    To qualify the preferred naming conventions:
    
    .mdf - Primary database data file.
    .ndf - Other database data files i.e. non Primary.
    .ldf - Log data file.
    

    what do you mean with creating mdf with qt ? did you create your sql database and trying to connect to it or you wish to create database files ?


Log in to reply
 

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