I created an internal tag with text char 16 and link it to the I/O filed and the output of this I/O field is string
I tested the link between the Wincc and the database and it is worked and recording another data types of real data format
But I tried to send the field with the string data type, it didn't work
The database column which I created was with nvarchar
Please check attached script of the button, can anybody help me to check where is the error
Code: Select all
Sub OnLButtonDown(ByVal Item, ByVal Flags, ByVal x, ByVal y)
Dim objConnection
Dim strConnectionString
Dim teto
Dim tetoo
Dim tetooo
Dim tetoooo
Dim strSQL
Dim objCommand
strConnectionString = "Provider=MSDASQL;DSN=Demo;UID=;PWD=;"
teto = HMIRuntime.Tags("nitro").Read
tetoo = HMIRuntime.Tags("watter").Read
tetooo = HMIRuntime.Tags("elec").Read
tetooo = HMIRuntime.Tags("delay").Read
strSQL = "INSERT INTO Table_1 (nit, water, elect,delay) VALUES (" & teto & "," & tetoo & "," & tetooo & "," & tetoooo & ");"
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