11/17/2018 6:52 AM | |
Posts: 5 Rating: (0) |
Hello Geeks ! 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 ! ------------------------------------------------------------------------------------------ |
Last edited by: Jen_Moderator at: 11/19/2018 12:44:39 PMNew subject after splitting |
|
Follow us on