为了忘却的记忆,也为了有缘的工控人进行学习借鉴,特粘贴如下:
Sub OpenDataBase
'******* define ADODB.Connection ********
Set objConnection = CreateObject("ADODB.Connection")
strConnectionString = "Provider=SQLOLEDB.1;Password=******;Persist Security Info=True; User ID = **;Initial Catalog = ******; Data Source = ******"
objConnection.ConnectionString = strConnectionString
objConnection.Open
Set objRecordset = CreateObject("ADODB.Recordset")
Set objCommand = CreateObject("ADODB.Command")
objCommand.ActiveConnection = objConnection
'************** Excute SQL **************
objCommand.CommandText = strSQL
'Set objRecordset = objCommand.Execute
End Sub
楼主最近还看过
[989]
[795]
[751]
[698]
[987]
[702]
[2131]
[813]
[1038]
[834]

客服
小程序
公众号