[email protected]
การติดต่อฐานข้อมูล MySQL Server
ติดต่อฐานข้อมูลโดยผ่าน ODBC
เชื่อมต่อฐานข้อมูล
Set Recordset = Server.CreateObject("ADODB.Recordset")
Recordset.ActiveConnection = "DSN4MySQL"
คำสั่ง SQL และสั่งให้ทำงาน
Recordset.Source = "SELECT * FROM book"
เริ่มเอ็กซิคิวต์คำสั่ง SQL
Recordset.Open()
ดึงข้อมูลครั้งละ 1 เรกคอร์ด
Response.Write(Recordset.Fields.Item("BARCODE").Value)
ปิดการเชื่อมต่อ
Recordset.Close()
คืนค่าตัวแปร
Set Recordset = Nothing
**การติดต่อ ต้องติดตั้ง ODBC ก่อนถึงจะเรียกใช้ได้
สร้างเมือวันที่ :29-06-2548