vb 对象refresh的方法 iadodc失败
一个text1.在数据库cwgl的sr表中查询与text1的输入数据相同的数据并显示在DataGrid1中,代码如下高手帮忙看看PrivateSubCommand1_Cl...
一个text1.在数据库cwgl的sr表中查询与text1的输入数据相同的数据并显示在DataGrid1中,代码如下 高手帮忙看看
Private Sub Command1_Click()
Dim strQuery As String
Command1.Enabled = False
Command2.Enabled = True
Command3.Enabled = True
d1 = Trim(Text1.Text)
Adodc1.CommandType = adCmdText
strQuery = "select * from SR where SRLX='" & d1 & "' "
Adodc1.RecordSource = strQuery
Adodc1.Refresh
If Adodc1.Recordset.RecordCount = 0 Then
MsgBox "不存在此记录!"
End If
End Sub
查询sr表中srlx列与text1相同的数据 展开
Private Sub Command1_Click()
Dim strQuery As String
Command1.Enabled = False
Command2.Enabled = True
Command3.Enabled = True
d1 = Trim(Text1.Text)
Adodc1.CommandType = adCmdText
strQuery = "select * from SR where SRLX='" & d1 & "' "
Adodc1.RecordSource = strQuery
Adodc1.Refresh
If Adodc1.Recordset.RecordCount = 0 Then
MsgBox "不存在此记录!"
End If
End Sub
查询sr表中srlx列与text1相同的数据 展开
展开全部
Private Sub Command1_Click()
Dim strQuery As String
Command1.Enabled = False
Command2.Enabled = True
Command3.Enabled = True
d1 = Trim(Text1.Text)
'添加完Adodc1控件后不需要对它的属性赋值。
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\数据库名.mdb;Persist Security Info=False"
strQuery = "select * from SR where SRLX='" & d1 & "' "
'注意SRLX字段的类型如果为数值型那么就要相应的转换d1的值。
Adodc1.RecordSource = strQuery
Adodc1.Refresh
If Adodc1.Recordset.RecordCount = 0 Then
MsgBox "不存在此记录!"
End If
End Sub
Dim strQuery As String
Command1.Enabled = False
Command2.Enabled = True
Command3.Enabled = True
d1 = Trim(Text1.Text)
'添加完Adodc1控件后不需要对它的属性赋值。
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\数据库名.mdb;Persist Security Info=False"
strQuery = "select * from SR where SRLX='" & d1 & "' "
'注意SRLX字段的类型如果为数值型那么就要相应的转换d1的值。
Adodc1.RecordSource = strQuery
Adodc1.Refresh
If Adodc1.Recordset.RecordCount = 0 Then
MsgBox "不存在此记录!"
End If
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询