毕设vb链接数据的程序出错 显示“要求对象”
我的查询功能的代码Private Sub Commandsearch_Click()
On Error GoTo Err_Commandsearch_Click
Dim sql As String
Dim rs As New ADODB.Recordset
sql = "SELECT * FROM 生产计划表 WHERE planid = '" & Textplanid & "';"
rs.Open sql, Adodc1.ConnectionString, adOpenStatic, adLockReadOnly
Textorderid.Text = rs("oderid")
Textplanstime.Text = rs("planstime")
Textplanetime.Text = rs("planetime")
If Not IsNull(rs("planftime")) Then
Textftime.Text = rs("planftime")
Else
Textftime.Text = "未完成"
End If
Textgjjid.Text = rs("gjjid")
Textgjjnum.Text = rs("gjjnum")
Textplanlv.Text = rs("planlv")
Textygid.Text = rs("ygid")
Textplantime.Text = rs("plantime")
Textplanremark.Text = rs("planremark")
DoCmd.GoToRecord , , acNewRec
Exit_Commandsearch_Click:
Exit Sub
Err_Commandsearch_Click:
MsgBox Err.Description
显示显示“要求对象” 但是点击确定之后 能看到查询的结果 --------------------编程问答-------------------- http://download.csdn.net/detail/veron_04/3827200 --------------------编程问答-------------------- sql = "SELECT * FROM 生产计划表 WHERE planid = '" & Textplanid & "';"
好像多了一个分号,应该是:
sql = "SELECT * FROM 生产计划表 WHERE planid = '" & Textplanid & "'"
补充:VB , 数据库(包含打印,安装,报表)