我想从mysql数据库表中检索列值(登录名,密码)到vbscript。我怎样才能做到这一点?我没有vbscript的经验,我将把它作为myproject的一部分。我成功连接到Mysql数据库表,但我不知道如何在vbscript中检索这些列值(两者都在varchar中)。我在谷歌搜索了很多,但没有得到帮助。有人可以帮帮我吗?
答案 0 :(得分:0)
以下是ASP中的一个示例,它应该可以帮到您需要的地方。注意这会给你一个断开连接的记录集,这是首选的方法,因为它会尽快将数据库连接释放回池:
<%@Language="VBScript"%>
<!-- Include file for VBScript ADO Constants -->
<!--#include File="adovbs.inc"-->
<%
' Connection string.
strCon = "Provider=sqloledb;Data Source=myServer;Initial Catalog=Northwind;User Id=myUser;Password=myPassword"
' Create the required ADO objects.
Set conn = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.recordset")
' Open the connection.
conn.Open strCon
' Retrieve some records.
strSQL = "Select * from Shippers"
rs.CursorLocation = adUseClient
rs.Open strSQL, conn, adOpenStatic, adLockOptimistic
' Disconnect the recordset.
Set rs.ActiveConnection = Nothing
' Release the connection.
conn.Close
' Check the status of the connection.
Response.Write("<BR> Connection.State = " & conn.State)
Set conn = Nothing
' Use the diconnected recordset here.
Response.Write("Column1")
Response.Write("Column2")
' Release the recordset.
rs.Close
Set rs = Nothing
%>
答案 1 :(得分:0)
这个问题的答案是我帮助你到达你需要的地方Connect to mysql 5.0 database using pure vbscript?