0% found this document useful (0 votes)
113 views

Wincc Script

This code connects to a database called "Mayur_Batch_Report" on the server "TESTING-PC\WINCC", queries the "Liquid" table to retrieve records where the "CHEMICAL_NAME" field matches a tag called "LIQUID.CHEMICAL_NAME", and sets the text and index of a combo box control using fields from the returned record.

Uploaded by

PMA PUNE
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
113 views

Wincc Script

This code connects to a database called "Mayur_Batch_Report" on the server "TESTING-PC\WINCC", queries the "Liquid" table to retrieve records where the "CHEMICAL_NAME" field matches a tag called "LIQUID.CHEMICAL_NAME", and sets the text and index of a combo box control using fields from the returned record.

Uploaded by

PMA PUNE
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Dim Program_List_Combo

Dim objConnection
Dim strConnectionString
Dim lngValue
Dim RcrdSt
Dim RS
Dim ServerName
ServerName = HMIRuntime.Tags("@TESTING-PC\WINCC").Read\WINCC_M

Set objConnection = CreateObject("ADODB.Connection")


strConnectionString = "Provider=MSDASQL;Initial Catalog=" &
SmartTags("Mayur_Batch_Report")&";DSN=WINCC_M"
objConnection.ConnectionString = strConnectionString
objConnection.Open
Dim cmd
Set cmd = CreateObject("ADODB.Command")
Set RS=CreateObject("ADODB.RecordSet")
With cmd
.ActiveConnection = objConnection
'.CommandText = "SELECT CHEMICAL_NAME FROM Liquid
.CommandText ="SELECT * FROM Liquid WHERE CHEMICAL_NAME = " &
SmartTags("LIQUID.CHEMICAL_NAME")
'.execute
Msgbox ("Cross_Check_Done")
End With
RS.Open cmd
Program_List_Combo.Index = RS.Fields("CHEMICAL_SAP_CODE").Value
Program_List_Combo.Text = RS.Fields("CHEMICAL_NAME").Value
'Msgbox RS.Fields("Program_Name").Value
RS.movenext
''Program_List_Combo.CountVisibleItems = count
RS.Close
''ScreenItems("Program_List").selectedindex = 1
End Sub

You might also like