发布于 2007-03-20 10:44:59
0楼
On Error Resume Next
Dim gocn, gorsAuthors
Set gocn = CreateObject("ADODB.Connection")
Set gorsAuthors= CreateObject("ADODB.Recordset")
'CONNECT TO MSACCESS DB
'cn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\WinCC V6 Workshop 0203\V6_demo3\Media\WinCCFac.mdb;Persist Security Info=False"
'CONNECT TO SQLSERVER, PUBS DB
gocn.open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;uid=sa;PWD=;Initial Catalog=pubs;Data Source=.\WinCC"
'gocn.open "DSN=rwer"
'gorsAuthors.open "SELECT au_id, au_fname, au_lname,contract FROM Authors ORDER BY au_lname", gocn, 2, 3
Dim oven
Set oven = HMIRuntime.Tags("oven")
Dim Time1
Set Time1 = HMIRuntime.Tags("time1")
Dim group
Set group = HMIRuntime.Tags("group")
Dim tnew
Set tnew = HMIRuntime.Tags("NewTag")
tnew.Write oven.Read
'gorsAuthors.AddNew
'gorsAuthors(0) = oven.Read
'gorsAuthors(1) = Time1.Read
'gorsAuthors(2) = group.Read
'gorsAuthors(3) = 1
'gorsAuthors.Update
gorsAuthors.open "insert into authors(au_id, au_fname, au_lname,contract) Values ('"&oven.Read&"' ,'"&Time1.Read&"','"&group.Read&"','1')",gocn,1,3
On Error Goto 0
此代码以能达到效果。
o! why? thinking...