Record OPC Data to MySQL

preview_player
Показать описание
Record OPC Data to MySQL using COPC32 ActiveX control.

Dim objConn As New MySqlConnection
Dim objCmd As New MySqlCommand
Dim strConnString, strSQL As String
Dim intNumRows As Integer

strConnString = "Server=localhost;User Id=root; Password=123456; Database=mydb; Pooling=false"

objConn.ConnectionString = strConnString

objConn.Open()

strSQL = "INSERT INTO t1 values (NOW()," & v(0) & "," & v(1) & "," & v(2) & ")"

objCmd = New MySqlCommand(strSQL, objConn)

intNumRows = objCmd.ExecuteScalar()

objConn.Close()
objConn = Nothing
Рекомендации по теме
Комментарии
Автор

Awesome video guy, thank you for teaching!

TomVectorG
Автор

you help me a lot bro, thankyou! keep up the good work bro!!!!

farhan
Автор

Dear Sir, I am trying to collect data from another server. my kepware, copc32 and visual studio in same server but database (mysql) is in another server. I have done works with visual studio but I failed to connect with mysql. (servers are connected via ethernet and all ports are open.) How can I do it can you help me please?

kaizokudc
Автор

Great work, I have receive this error can you help me?
'Authentication to host 'localhost' for user 'root' using method 'caching_sha2_password' failed with message: Access denied for user 'root'@'localhost' (using password: YES)'

abomohamedalrubee
Автор

Great video helped alot. Do you know what to do if the value in Axopc1.GetVl(1) is a string value? It works fine as integers, but when i try with a string, instead of recording the value i get a error "Unknown column "ABCD1234" in "field list"
ABCD1234 is the current value of my string at (Axopc1.GetVl(1)) and in MySql the datatype is defined as a Varchar(45)

tommynesset
visit shbcf.ru