Qt-interest Archive, May 2007
QSqlQueryModel and Binding
Message 1 in thread
Hi.I have QTableView and like update while QLineEdit changeAs I make to use variable in a command SQL for a QSqlQueryModel, as well as I make for QSqlQuery with bindValues?SQL example:"SELECT S.CODIGO, S.SITUATION, P.COD, P.PRODUCT, P.COD_SIT FROM SITUATION S, PRODUCT P WHERE S.CODIGO = :COD_QLINEEDIT AND S.CODIGO = P.COD_SIT ORDER BY P.PRODUCT"Thanks,Marcelo Estanislau.
_________________________________________________________________
O Windows Live Spaces já chegou! É fácil criar o seu próprio Web site pessoal.
http://spaces.live.com/signup.aspx
Message 2 in thread
Marcelo Estanislau Geyer wrote:
> Hi.
> I have QTableView and like update while QLineEdit change
> As I make to use variable in a command SQL for a QSqlQueryModel, as well
> as I make for QSqlQuery with bindValues?
> SQL example:
>
> "SELECT S.CODIGO, S.SITUATION, P.COD, P.PRODUCT, P.COD_SIT FROM
> SITUATION S, PRODUCT P WHERE S.CODIGO = :COD_QLINEEDIT AND S.CODIGO =
> P.COD_SIT ORDER BY P.PRODUCT"
>
> Thanks,
>
> Marcelo Estanislau.
>
Create a QSqlQuery, prepare it, bind the values and execute. Then pass
it to the model.
See the docs for QSqlQueryModel::setQuery(const QSqlQuery &query):
http://doc.trolltech.com/4.2/qsqlquerymodel.html#setQuery
--
[ signature omitted ]