labell 应该写成 label1:
Private Sub Command1_Click()
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
conn.ConnectionString = "driver=sql server; server=192.168.2.17;uid=sa;pwd=;database=master"
conn.Open
If conn.State = 1 Then
Label1.Caption = "数据库连接成功"
Else
Label1.Caption = "数据库不连接成功"
End If
conn.Execute "create table person_2(driver_id varchar(15),city varchar(20))"
MsgBox ("连接成功")
End Sub
工程--引用--microsoft. activex data ...2.5
的顶顶顶顶顶的顶顶顶顶顶