2011年11月13日 星期日
ASP 連 MySQL
1.需下載和安裝 MySQL 的 ODBC,安裝好後,可至系統管理工具->ODBC內看是否有安裝好
2.ASP 程式:
sConnection = "DRIVER={MySQL ODBC 5.1 Driver}; SERVER=mysql_ip; DATABASE=databasename; UID=password;PASSWORD=password; OPTION=3"
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open(sConnection)
sSQL = "SELECT * FROM ci, rr, fp, fm " _
& "WHERE rr.record_time between CURDATE() and CURDATE()+INTERVAL 1 DAY AND rr.card_id > 0 AND rr.eventcode = 0 AND rr.card_id = ci.card_id " _
& "AND rr.project_id = fp.project_id AND fp.factory_id = fm.factory_id AND rr.record_method = 1 "
Set objRS=objConn.Execute(sSQL)
While Not objRS.EOF
Response.write( objRS.Fields("card_number"))
objRS.MoveNext
Wend
objRS.Close
Set objRS = Nothing
objConn.Close
Set objConn = Nothing
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言