tags:

views:

231

answers:

2

Hi,

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?

A: 

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.

RedFilter
A: 

The answer to this question my help you get to where you need to be http://stackoverflow.com/questions/1366516/connect-to-mysql-5-0-database-using-pure-vbscript

John Boker