Hai guys I haven't received any answer regarding my
previous question about retrieve data from database
(using odbc) and put it the results into a wxListCtrl.
This is my code:
self.list = wxListCtrl(self, tID,
style=wxLC_REPORT|wxSUNKEN_BORDER)#|wxLC_VRULES|wxLC_HRULES)
if 0:
self.list.InsertColumn(0, "ID")
self.list.InsertColumn(1, "Name",
wxLIST_FORMAT_CENTER)
else:
info = wxListItem()
info.m_mask = wxLIST_MASK_TEXT |
wxLIST_MASK_FORMAT
info.m_format = 0
info.m_text = "ID"
self.list.InsertColumnInfo(0, info)
info.m_format = wxLIST_FORMAT_CENTER
info.m_text = "Name"
self.list.InsertColumnInfo(1, info)
total = len(self.Kueri())
grade = self.Kueri()
for sum_of_data in range(total):
self.list.SetStringItem(sum_of_data, 0,
grade[sum_of_data][0])
self.list.SetStringItem(sum_of_data, 1,
grade[sum_of_data][1])
def Kueri(self):
s = odbc.odbc('mysql/user/passwd')
cur = s.cursor()
cur.execute('select * from user')
rec = cur.fetchall()
return rec
When running this codes I got Error:
TypeError: String or Unicode type nedded
I think it was referring to the SetStringItem; I guess
Help me out pleaseeeee
···
__________________________________________________
Do You Yahoo!?
Yahoo! Tech - Get in touch with the latest in technology.
http://sg.tech.yahoo.com