发布于 2005-05-25 21:16:55
0楼
Dim cnn
Dim strcnn
Dim rst
Dim com
Set cnn = CreateObject("ADODB.Connection")
strcnn = "Provider=sqloledb;data source=机器名;initial catalog=数据库名;integrated security=sspi"
cnn.open(strcnn)
Set rst = CreateObject("ADODB.Recordset")
Set com = CreateObject("ADODB.Command")
Com.Commandtype=1
Set Com.ActiveConnection= cnn
Dim name1
Dim name2
Set name1 = HMIRuntime.Tags("name")
name2=name1.Read
Com.Commandtext="select password from tblUser where username='"& name2 & " '"
(以上你可以写成插入语句,就可以写数据了。)
(我代码里是读变量name的值,然后查询用户表等于name的记录)
Set rst = Com.Execute
bluecloud009