ederbs
14th January 2007, 01:14
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.
/* Creating the QSqlForm */
QSqlForm* dataBrowserForm = new QSqlForm( this, "dataBrowserForm" );
dataBrowserForm->insert( textEditDescricao, "de_inicial" );
dataBrowserForm->insert( dateTimeEditOcorrencia, "ts_ocorrencia" );
dataBrowserForm->insert( dateEditDataAtendimento, "dt_ocorrencia" );
dataBrowserForm->insert( timeEditDataAtendimento, "tm_ocorrencia" );
dataBrowserForm->insert( txtTelefone, "nr_fone" );
dataBrowserForm->insert( txtSolicitante, "nm_pessoa" );
dataBrowserForm->insert( txtCEP, "nr_cep_prv" );
dataBrowserForm->insert( txtLocalAtendimento, "nm_logradouro_prv" );
dataBrowserForm->insert( txtComplemento, "nm_complemento" ); /*
here it can be NULL */
dataBrowserForm->insert( txtReferencia, "nm_referencia" );
dataBrowserForm->insert( txtNumero, "nr_edificacao" );
dataBrowserForm->insert( cmbBairroLogradouro->lineEdit(), "nm_bairro_prv" );
dataBrowser->setForm( dataBrowserForm );
clearWState( WState_Polished );
/* Creating the QDataBrowser */
if ( dataBrowser )
{
if ( !dataBrowser->sqlCursor() )
{
QSqlCursor* cursor = new QSqlCursor( "vw_inser_ocorrencia" );
dataBrowser->setSqlCursor( cursor, TRUE );
dataBrowser->clearValues();
dataBrowser->insert();
dataBrowser->refresh();
}
QDialog::polish();
}
Ederson de Moura
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.
/* Creating the QSqlForm */
QSqlForm* dataBrowserForm = new QSqlForm( this, "dataBrowserForm" );
dataBrowserForm->insert( textEditDescricao, "de_inicial" );
dataBrowserForm->insert( dateTimeEditOcorrencia, "ts_ocorrencia" );
dataBrowserForm->insert( dateEditDataAtendimento, "dt_ocorrencia" );
dataBrowserForm->insert( timeEditDataAtendimento, "tm_ocorrencia" );
dataBrowserForm->insert( txtTelefone, "nr_fone" );
dataBrowserForm->insert( txtSolicitante, "nm_pessoa" );
dataBrowserForm->insert( txtCEP, "nr_cep_prv" );
dataBrowserForm->insert( txtLocalAtendimento, "nm_logradouro_prv" );
dataBrowserForm->insert( txtComplemento, "nm_complemento" ); /*
here it can be NULL */
dataBrowserForm->insert( txtReferencia, "nm_referencia" );
dataBrowserForm->insert( txtNumero, "nr_edificacao" );
dataBrowserForm->insert( cmbBairroLogradouro->lineEdit(), "nm_bairro_prv" );
dataBrowser->setForm( dataBrowserForm );
clearWState( WState_Polished );
/* Creating the QDataBrowser */
if ( dataBrowser )
{
if ( !dataBrowser->sqlCursor() )
{
QSqlCursor* cursor = new QSqlCursor( "vw_inser_ocorrencia" );
dataBrowser->setSqlCursor( cursor, TRUE );
dataBrowser->clearValues();
dataBrowser->insert();
dataBrowser->refresh();
}
QDialog::polish();
}
Ederson de Moura