Results 1 to 2 of 2

Thread: QSqlForm

  1. #1
    Join Date
    Sep 2006
    Location
    Rio de Janeiro, Brazil
    Posts
    44
    Thanks
    2
    Thanked 3 Times in 3 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11

    Default QSqlForm

    Hi,

    I am using one "view" to insert the data in the database. However it exists 3 fields in "view" that they are not "obligator", as I make to pass "NULL" in these fields, when will not be filled by the user.

    Qt Code:
    1. /* Creating the QSqlForm */
    2. QSqlForm* dataBrowserForm = new QSqlForm( this, "dataBrowserForm" );
    3. dataBrowserForm->insert( textEditDescricao, "de_inicial" );
    4. dataBrowserForm->insert( dateTimeEditOcorrencia, "ts_ocorrencia" );
    5. dataBrowserForm->insert( dateEditDataAtendimento, "dt_ocorrencia" );
    6. dataBrowserForm->insert( timeEditDataAtendimento, "tm_ocorrencia" );
    7. dataBrowserForm->insert( txtTelefone, "nr_fone" );
    8. dataBrowserForm->insert( txtSolicitante, "nm_pessoa" );
    9. dataBrowserForm->insert( txtCEP, "nr_cep_prv" );
    10. dataBrowserForm->insert( txtLocalAtendimento, "nm_logradouro_prv" );
    11. dataBrowserForm->insert( txtComplemento, "nm_complemento" ); /*
    12. here it can be NULL */
    13. dataBrowserForm->insert( txtReferencia, "nm_referencia" );
    14. dataBrowserForm->insert( txtNumero, "nr_edificacao" );
    15. dataBrowserForm->insert( cmbBairroLogradouro->lineEdit(), "nm_bairro_prv" );
    16. dataBrowser->setForm( dataBrowserForm );
    17. clearWState( WState_Polished );
    18.  
    19. /* Creating the QDataBrowser */
    20. if ( dataBrowser )
    21. {
    22. if ( !dataBrowser->sqlCursor() )
    23. {
    24. QSqlCursor* cursor = new QSqlCursor( "vw_inser_ocorrencia" );
    25. dataBrowser->setSqlCursor( cursor, TRUE );
    26. dataBrowser->clearValues();
    27. dataBrowser->insert();
    28. dataBrowser->refresh();
    29. }
    30.  
    31. QDialog::polish();
    32. }
    To copy to clipboard, switch view to plain text mode 

    Ederson de Moura
    Last edited by e8johan; 14th January 2007 at 16:38. Reason: missing [code] tags

  2. #2
    Join Date
    Jan 2006
    Location
    Alingsås, Sweden
    Posts
    437
    Thanks
    3
    Thanked 39 Times in 39 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QSqlForm

    I'm sorry but could you be a bit more specific in your question. I see a statement, but no question marks.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.