(0)| 8/10/2023 11:17 AM | |
|
Posts: 2 Rating:
|
Hello ! I have created table in SQL Server Management Studio in write the VBScript in the WinCC but when run the WinCC data not reading in the table. Dim objconnection Dim strConnectionString Dim SENSOR1 Dim SENSOR2 Dim SENSOR3 Dim SENSOR4 Dim SENSOR5 Dim SENSOR6 Dim SENSOR7 Dim SENSOR8 Dim strSQL Dim objCommand 'Connectionstring with with SQL connection strConnectionString = "Provider=MSDASQL;DSN=PLC;UID=;PWD=:" 'READ TEMPERATURE TAGS FROM PROGRAM BLOCKS SENSOR1 =SmartTags("Temp_IO_DB_AO1") SENSOR2 =SmartTags("Temp_IO_DB_AO2") SENSOR3 =SmartTags("Temp_IO_DB_AO3") SENSOR4 =SmartTags("Temp_IO_DB_AO4") SENSOR5 =SmartTags("Temp_IO_DB_AO5") SENSOR6 =SmartTags("Temp_IO_DB_AO6") SENSOR7 =SmartTags("Temp_IO_DB_AO7") SENSOR8 =SmartTags("Temp_IO_DB_AO8") 'INSERT DATA TO TABLE OF SQL DATABASE strSQL ="INSERT INTO tb1 (SENSOR1, SENSOR2, SENSOR3, SENSOR4, SENSOR5, SENSOR5, SENSOR6, SENSOR7, SENSOR8) VALUES("& SENSOR1 &", "& SENSOR2 &","& SENSOR3 &","& SENSOR4 &","& SENSOR5 &","& SENSOR6 &","& SENSOR7 &","& SENSOR8 &");" Set objconnection =CreateObject("ADODB.Connection") objconnection.ConnectionString = strConnectionString objconnection.Open Set objCommand = CreateObject("ADODB.Command") With objCommand .ActiveConnection = objConnection .CommandText = strSQL End With objCommand.Execute Set objCommand = Nothing objconnection.Close Set objconnection = Nothing End Sub Please help ------------------------------------------------------------------------------------------ |
Last edited by: Jen_Moderator at: 08/11/2023 07:44:32New subject after splitting |
|
| 8/11/2023 7:45 AM | |
|
Posts: 8171 Rating:
|
Closed cause question posted twice. The second thread with the subject WinCC Runtime Data not logging in SQL Server Management Studio table is published within the conference SIMATIC WinCC. Jen_Moderator |
Follow us on