MS-SQLへの接続
AutoITサンプルコード-MicrosoftSQLデータベースサーバーへの接続
;===============================================================================
; Description: Connecting to a MS-SQL database server
; Author(s): Videre Research, LLC - http://videreresearch.com
;===============================================================================
$sqlCon = ObjCreate("ADODB.Connection")
$sqlCon.Open("Provider=SQLOLEDB;Data Source=change_me_server_name;Initial Catalog=change_me_database_name;Connect Timeout=150;Network Library=dbmssocn; User ID=change_me; Password=change_me;")
IF IsObj($sqlCon) then
$rs = ObjCreate( "ADODB.RecordSet" )
$rs.Open( "SELECT * from change_me_table_name where last_updated > '" & @MON&"/"&@MDAY&"/"&@YEAR & "' order by last_updated", $sqlCon )
$recordcount =0
While $rs.eof <> TRUE
ConsoleWrite($rs.Fields( "userid" ).Value & @CRLF)
ConsoleWrite($rs.Fields( "log_results" ).Value & @CRLF & @CRLF)
for $x in $rs.Fields
ConsoleWrite($x.name)
ConsoleWrite(" = ")
ConsoleWrite($x.value & @CRLF)
next
$recordcount +=1
$rs.MoveNext
WEnd
$rs.Close
$sqlCon.Close
ConsoleWrite($recordcount & @CRLF)
EndIf
投稿コメント 0