Display data from DB to Grid

Paul McNett <p@ulmcnett.com>:

Perhaps the GridCustDataTable.py example in the demo directory
will get you going with your assignment? Assuming you already
know how to use the Python dbapi to query the PostgreSQL server
and get the results into a sequence, which I can't really tell
from either of your messages.

i've used GridCustDataTable.py to display it before.And i already know how to use dbapi
(i used pgdb.py). But the trouble is to send the variable that contain member_id to the
other object (GridCustDataTable.py).
in GridCustDataTable.py i test the query like this:
"select * from member" and it works to display all data of member, but i want the query
like this to my project :
"select * from member where member_id='"+var_member_id+"'". where the var_member_id is
the value of variable from my dialog input.

javanehese2003 wrote:

Paul McNett <p@ulmcnett.com>:

Perhaps the GridCustDataTable.py example in the demo directory
will get you going with your assignment? Assuming you already
know how to use the Python dbapi to query the PostgreSQL server
and get the results into a sequence, which I can't really tell
from either of your messages.

i've used GridCustDataTable.py to display it before.And i already know how to use dbapi
(i used pgdb.py). But the trouble is to send the variable that contain member_id to the other object (GridCustDataTable.py).
in GridCustDataTable.py i test the query like this: "select * from member" and it works to display all data of member, but i want the query like this to my project :
"select * from member where member_id='"+var_member_id+"'". where the var_member_id is the value of variable from my dialog input.

You will need to know if var_member_id is a string or an integer value.

If it is a string:
var_member_id = str(var_member_id)

for an integer
var_member_id = int(var_member_id)

Know form the select statement as follows:

"select * from member where member_id=%s"%repr(var_member_id)

This will place the appropriate quotes for the sql statement for string values, or leave it an integer for integer values.

Brian Kelley