หรือจะลองทำแบบ ODBC
ตัวอย่างรายงาน 504
_server='192.168.0.1'
_user='sa'
_psw='sa'
_database='hos'
_connect = ;
"Driver={MySQL ODBC 3.51 Driver};" + ;
"Server=" + _server + ";" + ;
"UID=" + _user + ";" + ;
"PASSWORD=" + _psw + ";" + ;
"Database="+_database+";" +;
"Port=3306;" + ;
"Option= 0 ;"+;
"Stmt =set names tis620;"
_handle=sqlstringconnect(_connect)
If _handle>0
_sql=[select a.*,ifnull(d.amount,0) as amount from rpt_504_name a left join ]+;
[(select b.id,count(b.id) as amount from rpt_504_code b,ovstdiag c ]+;
[where c.icd10 between b.code1 and b.code2 and c.icd10 is not null ]+;
[and c.vstdate between '2008-1-1' and '2008-1-31' ]+;
[group by b.id) d on d.id=a.id ]+;
[order by a.id ]
if sqlexec(_handle,_sql,'TEMP')>0
brow &&แสดงข้อมูลที่คำนวณได้
else
=aeeror(test)
=messagebox('คำสั่ง SQL ผิด',0,'Error')
endif
=sqldisconnect(_handle)
else
=aerror(test)
=messagebox('ติดต่อ HOSxP ไม่ได้'+chr(13)+test(1,2),0,'Error')
endif
ควรใช้ MySQL ODBC Driver vesion 3.51.15 ขึ้นไป