Gabriel B. C.
Member
Good morning Parky, I'm trying to use this script from you in factorytalk 8.0 on supervisor to throw values into a sql table.
I am having a little trouble communicating with my slq.
What would this CookerBatch be?
Where do I put in the name of my slq table?
It has as a peculiar aid.
Private Sub Button1_Released()
'Declare variables
Set objMyConn = New ADODB.Connection
Set objMyCmd = New ADODB.Command
Set objMyRecordSet = New ADODB.Recordset
Dim PLCTestTag As Integer
objMyConn.ConnectionString = " Provider=SQLOLEDB.1;Server=SE06\FTVIEWX64TAGDB;Database =PLC1DB;Trusted_Connection=yes"
objMyConn.Open
'Set and Excecute SQL Command
Set objMyCmd.ActiveConnection = objMyConn
objMyCmd.CommandText = "INSERT INTO BatchTable (TLC1_BatchNo,TLC1_Truck,TLC1_Start,TLC1_Stop,TLC1_StartTime,TLC1_StopTime,TLC1_Pump,TLC1_Tank,TLC1_Product,TLC1_SP,TLC1_FT,TLC1_Name) Values (" & TLC1_BatchNo & "," & TLC1_Truck & "," & TLC1_Start & "," & TLC1_Stop & "," & TLC1_StartTime & "," & TLC1_StopTime & "," & TLC1_Pump & "," & TLC1_Tank & "," & TLC1_Product & "," & TLC1_SP & "," & TLC1_FT & "," & TLC1_Name & ")"
objMyCmd.CommandType = adCmdText
objMyCmd.Execute
'Close Connection
objMyConn.Close
End Sub
I am having a little trouble communicating with my slq.
What would this CookerBatch be?
Where do I put in the name of my slq table?
It has as a peculiar aid.
Private Sub Button1_Released()
'Declare variables
Set objMyConn = New ADODB.Connection
Set objMyCmd = New ADODB.Command
Set objMyRecordSet = New ADODB.Recordset
Dim PLCTestTag As Integer
objMyConn.ConnectionString = " Provider=SQLOLEDB.1;Server=SE06\FTVIEWX64TAGDB;Database =PLC1DB;Trusted_Connection=yes"
objMyConn.Open
'Set and Excecute SQL Command
Set objMyCmd.ActiveConnection = objMyConn
objMyCmd.CommandText = "INSERT INTO BatchTable (TLC1_BatchNo,TLC1_Truck,TLC1_Start,TLC1_Stop,TLC1_StartTime,TLC1_StopTime,TLC1_Pump,TLC1_Tank,TLC1_Product,TLC1_SP,TLC1_FT,TLC1_Name) Values (" & TLC1_BatchNo & "," & TLC1_Truck & "," & TLC1_Start & "," & TLC1_Stop & "," & TLC1_StartTime & "," & TLC1_StopTime & "," & TLC1_Pump & "," & TLC1_Tank & "," & TLC1_Product & "," & TLC1_SP & "," & TLC1_FT & "," & TLC1_Name & ")"
objMyCmd.CommandType = adCmdText
objMyCmd.Execute
'Close Connection
objMyConn.Close
End Sub