12/31/2022 1:59 PM | |
Joined: 7/23/2019 Last visit: 5/7/2024 Posts: 7 Rating:
|
Hello , sorry for intruding, with Wincc RT v16 I write data in SQl using VBS Scriptin . With this piece of code I write: SQL_Table = "SELECT * FROM " & SmartTags("DB_SQL_Table") ' SQL_Table = "INSERT INTO "& SmartTags("DB_SQL_Table") & " VALUES('" & SmartTags("DB_SQL_id") & _ "' , '" & SmartTags("SQL_DB_article")& _ "' , '" & SmartTags("DB_SQL_batch")& _ "' , '" & SmartTags("DB_SQL_serial")& "')" Set rst = conn.Execute(SQL_Table) °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° Then with these Instructions I read and check if the Record has been written in SQL Serial_to_Search = SmartTags("DB_SQL_serial") Comm_Search__serial = "SELECT * FROM " & Table & " WHERE seriale Like " & Serial_to_Search Set rst = conn.Execute(Comm_Search__serial) °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° °°°°°°°°°°°°°°°°°°°°°°°°°°° But first you have to connect to the Server, and to the SQL database with Set conn = CreateObject("ADODB.Connection") Set rst = CreateObject("ADODB.Recordset") conn.Open "Provider=MSDASQL;Initial Catalog=" & " ;PORT-MPA\WINCCPLUSMIG2014" & ";DataBase=omb" & ";DSN=Work_PC" I have a problem that I can't solve... In the SQL column called "serial" I wrote some ess values: 4444444444 1234567890 AAA33333333333 and so far there is no problem. When I go to read values in serial column from Wincc RT to SQL 4444444444 1234567890 all ok When I search in the serial column AAA3333333333 it gives me ODBC error .... I have tried and searched many solutions, but I could not find a solution to my problem ------------------------------------------------------------------------------------------ |
Last edited by: Jen_Moderator at: 01/02/2023 09:23:56New subject after splitting |
|
1/2/2023 11:55 AM | |
Joined: 4/26/2012 Last visit: 4/25/2025 Posts: 1629 Rating:
|
Hi, you can put this to try to read more specific the SQL return error.
Here is a LINK with SQL examples. good luck.
|
Last edited by: rdoliveira at: 01/02/2023 12:12:17Last edited by: Jen_Moderator at: 01/02/2023 13:05:19Link optimized. Last edited by: Jen_Moderator at: 01/02/2023 13:06:24Link optimized again, now it is in English. "Always make a backup before performing any tests |
|
1/3/2023 7:20 AM | |
Joined: 7/23/2019 Last visit: 5/7/2024 Posts: 7 Rating:
|
File Script .
AttachmentScript Pag_2.txt (567 Downloads) |
Follow us on