달력

1

« 2025/1 »

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
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

:
Posted by 커널64