Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. Spanish
  4. Obtener el tipo de datos de las columnas de una tabla usando QSqlTableModel
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved Spanish
3 Posts 2 Posters 3.0k 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.
  • M Offline
    M Offline
    mrondon
    wrote on last edited by
    #1

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

    1 Reply Last reply
    0
    • EddyE Offline
      EddyE Offline
      Eddy
      wrote on last edited by
      #2

      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
      0
      • M Offline
        M Offline
        mrondon
        wrote on last edited by
        #3

        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
        0

        • Login

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