开发者

How to retrieve column values in vbscript

I want to retrieve column values(login,password) from my mysql database table to vbscript. How can I do that? I've no experience of vbscript, and I've to do that as a part of myproject. I'm sucessful in connecting to Mysql database table, but I don't开发者_开发百科 know how to retrieve those column values(both are in varchar) in vbscript. I searched in google a lot, but got no help. Could anyone please help me?


The answer to this question my help you get to where you need to be Connect to mysql 5.0 database using pure vbscript?


Here is an example in ASP, it should get you where you need to go. Note this gives you a disconnected recordset, which is the preferred way to go as it releases the db connection back to the pool as quickly as possible:

<%@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
%>

You can get the full contents of adovbs.inc here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜