dim conn as new adodb.connection With conn If .State = adStateOpen Then .Close .ConnectionString = "driver=SQL Server;server=计算机名或IP地址;uid=SA;pwd=;database=数据库名" .CommandTimeout = 0 .Open End With
microsoft ado data control 属性里可以设置连接
http://zhidao.baidu.com/question/7971028
5L回答正确。 回答3L:把 conn 定义为全局变量,第一次用到 conn 之前进行初始化(1L中的代码)即可 以后执行SQL语句就可以这样写strsql="select * from table1" rs.open strsql,conn,3,2 txtCode.text=rs!tcodeconn.execute "update table1 set isum=0 where id=32"
With conn
If .State = adStateOpen Then .Close
.ConnectionString = "driver=SQL Server;server=计算机名或IP地址;uid=SA;pwd=;database=数据库名"
.CommandTimeout = 0
.Open
End With
属性里可以设置连接
回答3L:把 conn 定义为全局变量,第一次用到 conn 之前进行初始化(1L中的代码)即可
以后执行SQL语句就可以这样写strsql="select * from table1"
rs.open strsql,conn,3,2
txtCode.text=rs!tcodeconn.execute "update table1 set isum=0 where id=32"