Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Obtener el tipo de datos de las columnas de una tabla usando QSqlTableModel

    Spanish
    2
    3
    2784
    Loading More Posts
    • 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.
    • M
      mrondon last edited by

      Como puedo saber el tipo de datos de las columnas de una tabla usando la clase QSqlTableModel

      1 Reply Last reply Reply Quote 0
      • E
        Eddy last edited by

        Moved to the spanish subforum. Most of us don't speak Spanish but English in the general subforum. You will find Spanish friends there ;)

        Qt Certified Specialist
        www.edalsolutions.be

        1 Reply Last reply Reply Quote 0
        • M
          mrondon last edited by

          Asi es como pude resolverlo
          @QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
          db.setDatabaseName("C:/Documents and Settings/mrondon/Desktop/TestingWithModel/debug/testingdb.db3");

          if(db.open()){
              TableModel *model = new TableModel("clientes");
              model->setQuery("SELECT * FROM " + model->tableName() + " LIMIT 1");
              for(int i = 0; i < model->columnCount(); i++ )
              {
                  qDebug() << "Campo:" << model->query().record().field(i).name()
                           << "Tipo Dato:" << model->query().record().field(i).type();
              }
          }@
          
          1 Reply Last reply Reply Quote 0
          • First post
            Last post