ผู้เขียน หัวข้อ: VFP9+ADO+MySQL5 ตัวอย่างโปรแกรมครับ  (อ่าน 8416 ครั้ง)

0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้

doramon

  • บุคคลทั่วไป
VFP9+ADO+MySQL5 ตัวอย่างโปรแกรมครับ
« เมื่อ: กรกฎาคม 06, 2008, 16:39:38 PM »
0
ตัวอยางบางตอนครับ :

Local Conn As ADODB.Connection

Local Rs As ADODB.Recordset

Conn=Createobject("ADODB.Connection")

Rs =Createobject("ADODB.Recordset")

If Conn.State=1 Then

Conn.Close()

Endif

Conn.ConnectionString="Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=sample;uid=root;pwd=admin;charset=tis620"

Conn.CommandTimeout=90

Conn.Open

Local sqlCmd As String

sqlCmd="Select * From book"

If rs.State=1 Then

rs.Close()

Endif

rs.ActiveConnection=Conn

rs.CursorLocation= 3 && adUseClient

rs.CursorType= 0 && adOpenForwardOnly

rs.LockType= 1 && adLockReadOnly

rs.Open(sqlCmd)

If rs.RecordCount >0 Then

DO WHILE NOT rs.EOF()

Wait Window rs.Fields(1).Value

rs.MoveNext

ENDDO

Endif

ออฟไลน์ admin30

  • Sr. Member
  • ****
  • กระทู้: 352
  • Respect: 0
    • ดูรายละเอียด
    • ioffer resume
Re: VFP9+ADO+MySQL5 ตัวอย่างโปรแกรมครับ
« ตอบกลับ #1 เมื่อ: กรกฎาคม 06, 2008, 22:52:02 PM »
0
อาจารย์อ็อด ช่วยอธิบายต่อด้วยนะครับ ผมสนใจเรื่อง VFP9 + MySQL ครับ

สนใจจริง ๆ ครับ อยากศึกษาครับ
HOSxP Server Master : MariaDb 10.1.19
ขึ้นระบบ 24 พ.ค.2550 โดย BMS Team
http://ikstudioytchannel.blogspot.com/
https://iofferresumer.blogspot.com/

ออฟไลน์ mkhospital03

  • Newbie
  • *
  • กระทู้: 1
  • Respect: 0
    • ดูรายละเอียด
Re: VFP9+ADO+MySQL5 ตัวอย่างโปรแกรมครับ
« ตอบกลับ #2 เมื่อ: กรกฎาคม 11, 2008, 13:43:36 PM »
0
อาจารย์อ็อด มีคำถามแล้วประสิทธิภาพการดึงข้อมูลผ่าน mysql เป็นอะไร เพราะว่าตอนนี้ผมใช้ VFP9+MYSQL อยู่ขณะนี้
 

ออฟไลน์ woravet

  • Sr. Member
  • ****
  • กระทู้: 409
  • Respect: +12
    • ดูรายละเอียด
Re: VFP9+ADO+MySQL5 ตัวอย่างโปรแกรมครับ
« ตอบกลับ #3 เมื่อ: กรกฎาคม 11, 2008, 16:21:06 PM »
0
หรือจะลองทำแบบ 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 ขึ้นไป
รพ.บึงสามัคคี จ.กำแพงเพชร
*********************
อ.สุชัยและคณะ ขึ้นระบบ 29 ตค.49(Linux+Fedara 5)
*********************
ปัจจุบัน
HOSxP version 3.53.4.27
Server:Windows XP SP2,MySQL 5
Client ประมาณ 15 เครื่อง