|
参考代码如下:
- <%
- Dim sConnection, objConn , objRS
- sConnection = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER={服务器名称}; DATABASE={数据库名}; UID={用户名};PASSWORD={登录密码}; OPTION=3"
- Set objConn = Server.CreateObject("ADODB.Connection")
- objConn.Open(sConnection)
- Set objRS = objConn.Execute("SELECT lastname, firstname FROM test ORDER By lastname")
- While Not objRS.EOF
- Response.Write objRS.Fields("firstname") & " " &
- objRS.Fields("lastname") & "<br>"
- objRS.MoveNext
- Wend
- objRS.Close
- Set objRS = Nothing
- objConn.Close
- Set objConn = Nothing
- %>
复制代码 |
|