VB:实时错误424,要求对象。求解决方法,在线等,求大神!!!
PrivateSubCommand1_Click()DimconnAsADODB.ConnectionSetconn=NewADODB.ConnectionSetrs=N...
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=K01-PC;uid=;pwd=;database=JXGL"
conn.Open
If conn.State = 1 Then
labell.Caption = "数据库连接成功"
Else
labell.Caption = "数据库不连接成功"
End If
conn.Execute ("create table person_2(driver_id varchar(15),city varchar(20)")
MsgBox ("连接成功")
End Sub 展开
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
conn.ConnectionString = "driver=sql server; server=K01-PC;uid=;pwd=;database=JXGL"
conn.Open
If conn.State = 1 Then
labell.Caption = "数据库连接成功"
Else
labell.Caption = "数据库不连接成功"
End If
conn.Execute ("create table person_2(driver_id varchar(15),city varchar(20)")
MsgBox ("连接成功")
End Sub 展开
展开全部
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
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
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2015-04-09
展开全部
的顶顶顶顶顶的顶顶顶顶顶
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询