Page 1 of 1

sql strings a better way?

Posted: Mon Oct 15, 2012 6:57 am
by metron9
Is making the string qstring in this function to call the sql function the only way to do this or is there a better way?

oh, and is there a timeout on an open mysql data table, do I want to open it and close it with destroy any time I access the table?

function searchmysql(parm1)
oDB:=connect2db()
parm1='92523257'
qstring:='select * from partbase where partno = "' + parm1 + '"'

msgbox(qstring)

aTable := sql( oDB, qstring)
cRecord := ''
for i := 1 to 1 // len( aTable )
cRecord:=alltrim('www.ccspecialorders.com/pictures/'+aTable[i,8])
showpicture(cRecord)
order_parts.info_text.Value := str(aTable[1])
next i
oDB:Destroy()
return nil

Re: sql strings a better way?

Posted: Mon Oct 15, 2012 9:24 am
by Rathinagiri
I think once connected, the connection will be retained for further queries. So, you need not connect and close every time you access.

I checked this with my own website hosted. However, I don't know about open mysql table.

Regarding the sql string, I have a function c2sql() for parsing. It is just like your application only.