달력

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
2010. 9. 9. 18:34

VB Script를 이용한 SQL 쿼리 Etc.2010. 9. 9. 18:34

VBS, VB Script, SQL, Query

Dim objCN, strConnection
Set objCN = CreateObject("ADODB.Connection")
strConnection = "Driver={SQL Server};Server=.;Trusted_Connection=TRUE"
objCN.Open strConnection

Dim strSQLQuery
strSQLQuery = "USE OperationsManager select * from dbo.AlertView GO"
Dim objRSSet
objRS=CreateObject("ADODB.Recordset")
Set objRS = objCN.Execute(strSQLQuery)

Do Until objRS.EOF
WScript.Echo objRS(0) '첫 번째 컬럼 출력
WScript.Echo objRS.Fields("Id") 'Id 이름의 컬럼 출력
objRS.MoveNext
Loop

objRS.Close
objCN.Close

:
Posted by 커널64