‘Simply specify a connection string, which identifies the data store you want to work with
strConnection = “DRIVER=SQL Server;SERVER=NLT-SQL;UID=sa;PWD=p@$$word;APP=QuickTest Professional;WSID=NTPC01032;DATABASE=casu10;”
Set oConn = CreateObject(“ADODB.Connection”) ‘ Create a Connection object
Set oCmd = CreateObject(“ADODB.Command”)
Set oConn = CreateObject(“ADODB.Connection”) ‘ Create a Connection object
Set oCmd = CreateObject(“ADODB.Command”)
oConn.Open strConnection ‘ Open a Connection
if (Err.Number 0) then
MsgBox “Unable to connect to database” & CR &_
“Error(” & Err.Number & “)” & CR &_
Err.Description
WScript.Quit
end if
MsgBox “Unable to connect to database” & CR &_
“Error(” & Err.Number & “)” & CR &_
Err.Description
WScript.Quit
end if
Set oCmd.ActiveConnection = oConn
oCmd.CommandText = “Select A_STATUS from RECORDINGPHASE where PHASENUMBER= (SELECT MAX(PHASENUMBER) FROM RECORDINGPHASE)”
set rs = oCmd.Execute ‘Execute method always returns a Recordset object
oCmd.CommandText = “Select A_STATUS from RECORDINGPHASE where PHASENUMBER= (SELECT MAX(PHASENUMBER) FROM RECORDINGPHASE)”
set rs = oCmd.Execute ‘Execute method always returns a Recordset object
rs.MoveFirst
Do Until rs.EOF
id_status= rs.fields(“A_STATUS”)
rs.MoveNext
loop
Do Until rs.EOF
id_status= rs.fields(“A_STATUS”)
rs.MoveNext
loop
‘ Close the connection.
rs.Close
oConn.Close
rs.Close
oConn.Close
set oCmd = nothing
set oConn = nothing
set oConn = nothing
No comments:
Post a Comment