2011. 6. 14. 20:38
[VBS] VBS를 통한 MySQL 쿼리 Etc.2011. 6. 14. 20:38
VBS VBScript MySQL
VBS를 통한 MySQL 쿼리, 이전에 먼저 MySQL ODBC Connector를 설치하여야 한다.
http://www.mysql.com/downloads/connector/odbc/
USER = "root"
PASSWORD = "Password"
SQLQUERY = "Show Variables"
ConnString = "DRIVER={MySQL ODBC 5.1 Driver};SERVER=localhost;USER="&USER&";PASSWORD="&PASSWORD
Set Connection = CreateObject("ADODB.Connection")
Set Recordset = CreateObject("ADODB.Recordset")
Connection.Open ConnString
Recordset.Open SQLQUERY,Connection
If Recordset.EOF Then
WScript.Echo "No rows returned."
WScript.Quit
Else
Do While NOT Recordset.EOF
WScript.Echo Recordset(0), Recordset(1)
Recordset.MoveNext
Loop
End If
Recordset.Close
Set Recordset=nothing
Connection.Close
Set Connection=nothing