WinCC OLEDB Connection String
WinCC OLEDB Connection String
1;Integrated Security=SSPI;Persist Sec urity Info=False;Initial Catalog=master;Data Source=" & LocMachineName & "\WINCC " strSQL = "SELECT RTRIM(name) as dbname FROM sysdatabases WHERE name LIKE 'CC%'" Set objConnection = CreateObject("ADODB.Connection") objConnection.ConnectionString = strConnectionString objConnection.Open Set objRecordset = CreateObject("ADODB.Recordset") Set objCommand = CreateObject("ADODB.Command") objCommand.ActiveConnection = objConnection objCommand.CommandText = strSQL Set objRecordset = objCommand.Execute lngCount = objRecordset.Fields.Count HMIRuntime.Trace lngCount & vbNewLine If (lngCount>0) Then objRecordset.movefirst For i = 0 To objRecordset.Fields.Count HMIRuntime.Trace objRecordset.Fields(0).Value & vbNewLine objRecordset.movenext Next Else HMIRuntime.Trace "Selection returned no fields" & vbNewLine End If Set objCommand = Nothing objConnection.Close Set objRecordset = Nothing Set objConnection = Nothing