Trying to write a client with Boa to connect to a MySQLdb. I dont know python very well. When i am getting data back from MySQL how should i send it to the txtbox for results...this is what i have:
try:
con = MySQLdb.Connect( host = self.server_txt_box.GetValue(),
user = self.user_txt_box.GetValue(),
passwd = self.password_txt_box.GetValue(),
db = self.database_txt_box.GetValue())
cursor = con.cursor()
query = self.query_txt_box.GetValue()
cursor.execute( query )
res = cursor.fetchall()
for rec in res:
for field in rec:
self.results_txt_box.AppendText(str(field))
con.close()
except MySQLdb.Error, e:
self.results_txt_box.AppendText("Error %d: %s" % (e.args[0], e.args[1]))
That prints everything on one line. I need to put a new line after each record is there a way to insert a carrige return or something?
Thanks
try:
con = MySQLdb.Connect( host = self.server_txt_box.GetValue(),
user = self.user_txt_box.GetValue(),
passwd = self.password_txt_box.GetValue(),
db = self.database_txt_box.GetValue())
cursor = con.cursor()
query = self.query_txt_box.GetValue()
cursor.execute( query )
res = cursor.fetchall()
for rec in res:
for field in rec:
self.results_txt_box.AppendText(str(field))
con.close()
except MySQLdb.Error, e:
self.results_txt_box.AppendText("Error %d: %s" % (e.args[0], e.args[1]))
That prints everything on one line. I need to put a new line after each record is there a way to insert a carrige return or something?
Thanks