<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.18702"></HEAD>
<BODY>
<DIV><FONT size=2 face=Arial><SPAN
class=391520013-21072009>Hello</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN class=391520013-21072009>I'm using PyQt
ODBC support to access a database. If I use QSqlQuery works fine, but when I use
QSqlTableModel the table is filled by the names of collums. An example
here:</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN
class=391520013-21072009></SPAN></FONT> </DIV>
<DIV><FONT size=2 face=Arial><SPAN
class=391520013-21072009>exp_1 exp_2
exp_3 exp_4</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN
class=391520013-21072009>name
date
time cheked</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN class=391520013-21072009><SPAN
class=391520013-21072009>name
date
time cheked</SPAN></SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN class=391520013-21072009><SPAN
class=391520013-21072009><SPAN class=391520013-21072009>name
date
time cheked</SPAN></SPAN></SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN class=391520013-21072009><SPAN
class=391520013-21072009><SPAN class=391520013-21072009><SPAN
class=391520013-21072009>name
date
time cheked</SPAN></SPAN></SPAN></SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN class=391520013-21072009><SPAN
class=391520013-21072009><SPAN class=391520013-21072009><SPAN
class=391520013-21072009></SPAN></SPAN></SPAN></SPAN></FONT> </DIV>
<DIV><FONT size=2 face=Arial><SPAN class=391520013-21072009><SPAN
class=391520013-21072009><SPAN class=391520013-21072009><SPAN
class=391520013-21072009>I have tracked the odbc call and I discovered that the
query that TableModel does is this:</SPAN></SPAN></SPAN></SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN class=391520013-21072009><SPAN
class=391520013-21072009><SPAN class=391520013-21072009><SPAN
class=391520013-21072009>select "<SPAN class=391520013-21072009>name", "date",
"time","cheked" from "prcli"</SPAN></SPAN></SPAN></SPAN></SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN class=391520013-21072009><SPAN
class=391520013-21072009><SPAN class=391520013-21072009><SPAN
class=391520013-21072009><SPAN class=391520013-21072009>This is the
selectstatemente of my QSqlTableModel. I think that the quotes are wrong.
How can I change the query to get something like
this?:</SPAN></SPAN></SPAN></SPAN></SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN class=391520013-21072009><SPAN
class=391520013-21072009><SPAN class=391520013-21072009><SPAN
class=391520013-21072009><SPAN class=391520013-21072009><SPAN
class=391520013-21072009><SPAN class=391520013-21072009><SPAN
class=391520013-21072009><SPAN class=391520013-21072009>select <SPAN
class=391520013-21072009>name, date, time,cheked from
prcli</SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><I>
<P align=left><FONT size=2>self</FONT></I><FONT
size=2>.model=QtSql.QSqlTableModel(<I>self</I>,cn)</FONT></P>
<P align=left><FONT size=2><I>self</I>.model.setTable(table<SPAN
class=391520013-21072009>Name</SPAN>)</FONT></P>
<P align=left><FONT
size=2>self.model.setEditStrategy(QtSql.QSqlTableModel.OnManualSubmit)</FONT></P>
<P align=left><FONT size=2><FONT color=#0000ff><FONT
color=#0000ff>print</FONT></FONT> <I>self</I>.model.selectStatement()<SPAN
class=391520013-21072009> # here I get this -><SPAN
class=391520013-21072009><SPAN class=391520013-21072009><SPAN
class=391520013-21072009><SPAN class=391520013-21072009><FONT face=Arial>select
"<SPAN class=391520013-21072009>name", "date", "time","cheked" from
"prcli"</SPAN></FONT></SPAN></SPAN></SPAN></SPAN></SPAN></FONT></P>
<P><FONT size=2><I>self</I>.model.select()</FONT></P></DIV>
<DIV align=left>
<DIV>
<DIV><SPAN class=615183507-15062009><FONT size=2
face=Arial></FONT></SPAN></DIV></DIV></DIV>
<DIV><FONT size=2 face=Arial><SPAN class=391520013-21072009>Ivan
Coronado</SPAN></FONT></DIV></BODY></HTML>