发表于:2007-10-31 11:05:00
楼主
用HMIRuntime对象读取变量值再写到数据库里,可是不管用啊!!!
要郁闷死了
各位老大给看看!
疯了
**********************************************
Sub X6309X94AE1X0000X0020_OnClick(Byval Item)
Dim objConnection
Dim strConnectionString
Dim zhi
Dim strSQL
Dim objCommand
strConnectionString = " Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;User ID=DBA;Initial Catalog=CC_shiyan5_07_10_29_18_39_24R;Data Source = MS-37A852D0C3ED\WINCC"
Set objConnection = CreateObject("ADODB.Connection")
objConnection.ConnectionString = strConnectionString
objConnection.Open
Set objCommand = CreateObject("ADODB.Command")
With objCommand
objCommand.ActiveConnectioN = objConnection
zhi = HMIRuntime.Tags("bianliang8").Read
strSQL = "INSERT INTO zifubianliang (TagValue) VALUES ("&zhi&");" '(" & lngValue & ")
objCommand.CommandTExt = strSQL
End With
objCommand.Execute
Set objCommAnd = Nothing
objConnection.Close
Set objConnectIon = Nothing
End Sub