11/19/2018 8:21 AM | |
Posts: 5 Rating: (0) |
Hi Mr.HarrY ji, I am trying to populate a Sql data on a Combo Box in winCC 7.4 using VBScript.But i cannot able to fetch the data so am in need of moment so please do the needful guys help me by some code to fetch database table at combobox in Script Code... 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 Thanks in Advance ! ------------------------------------------------------------------------------------------ AttachmentCombobox Code.pdf (178 Downloads) |
Last edited by: Jen_Moderator at: 11/19/2018 2:45:57 PMNew subject after splitting |
|
11/19/2018 2:47 PM | |
Joined: 6/19/2017 Last visit: 6/28/2024 Posts: 8176 Rating: (169) |
Closed cause question posted twice. The second thread with the subject Trying to populate a Sql data on a Combo Box in WinCC 7.4 using VBScript is published within the conference SIMATIC WinCC.
Jen_Moderator |
My Forum is the place to personalize your profile, |
|
Follow us on