Mailinglist Archive: opensuse-programming (84 mails)
| < Previous | Next > |
cursor.select("custid = %1").arg(cid);
- From: Prabu Subroto <prabu_subroto@xxxxxxxxx>
- Date: Fri, 6 Aug 2004 05:20:52 -0700 (PDT)
- Message-id: <20040806122052.16644.qmail@xxxxxxxxxxxxxxxxxxxxxxx>
Dear my friends...
I want to diplay the salesreports only for a
determined customer (with custid) into a QDataTable. I
use QSqlCursor for doing "select" from a view (false
table).
I did like this:
"
void funonseqForm::sejarahSlot()
{
cid = QSpinBoxCustid->text();
QSqlDatabase * bd =
QSqlDatabase::addDatabase("QPSQL7", "OTHER");
bd->setHostName("192.168.23.237");
bd->setDatabaseName("kv");
bd->setUserName("postgres");
bd->setPassword("");
if ( ! bd->open() )
{
bd->lastError().showMessage();
}
QSqlCursor * cursor = new
QSqlCursor("salesreport", true, bd);
cursor.select("custid = %1").arg(cid);
custdataBrowser->setSqlCursor(cursor, false);
custdataBrowser->refresh();
}
"
but I got this error message in compiling process
In file included from .ui/funonseqform.cpp:34:
funonseqform.ui.h: In member function `virtual void
funonseqForm::sejarahSlot()':
funonseqform.ui.h:36: error: invalid conversion from
`const char*' to `int'
funonseqform.ui.h:48: error: request for member
`select' in `cursor', which is of non-aggregate type
`QSqlCursor*'
make: *** [.obj/funonseqform.o] Error 1
patrixlinux@patrix:~/arsip/proyek/qt/kv/client>
how can I change the data type from the text of
QSpinBox (QString) into "int"?
And how can I do a selection with QSqlCursor.select()
but the value of cid variable must be whenever
changeable.
Thank you very much in advance.
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail
I want to diplay the salesreports only for a
determined customer (with custid) into a QDataTable. I
use QSqlCursor for doing "select" from a view (false
table).
I did like this:
"
void funonseqForm::sejarahSlot()
{
cid = QSpinBoxCustid->text();
QSqlDatabase * bd =
QSqlDatabase::addDatabase("QPSQL7", "OTHER");
bd->setHostName("192.168.23.237");
bd->setDatabaseName("kv");
bd->setUserName("postgres");
bd->setPassword("");
if ( ! bd->open() )
{
bd->lastError().showMessage();
}
QSqlCursor * cursor = new
QSqlCursor("salesreport", true, bd);
cursor.select("custid = %1").arg(cid);
custdataBrowser->setSqlCursor(cursor, false);
custdataBrowser->refresh();
}
"
but I got this error message in compiling process
In file included from .ui/funonseqform.cpp:34:
funonseqform.ui.h: In member function `virtual void
funonseqForm::sejarahSlot()':
funonseqform.ui.h:36: error: invalid conversion from
`const char*' to `int'
funonseqform.ui.h:48: error: request for member
`select' in `cursor', which is of non-aggregate type
`QSqlCursor*'
make: *** [.obj/funonseqform.o] Error 1
patrixlinux@patrix:~/arsip/proyek/qt/kv/client>
how can I change the data type from the text of
QSpinBox (QString) into "int"?
And how can I do a selection with QSqlCursor.select()
but the value of cid variable must be whenever
changeable.
Thank you very much in advance.
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail
| < Previous | Next > |