VB:实时错误424,要求对象。求解决方法,在线等,求大神!!!

2024-11-22 01:44:40
推荐回答(3个)
回答1:

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

回答2:

工程--引用--microsoft. activex data ...2.5

回答3:

的顶顶顶顶顶的顶顶顶顶顶