在datagrid中显示数据视图 [英] show data view in datagrid
本文介绍了在datagrid中显示数据视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请帮助我,我需要在datagrid中显示数据搜索.我有示例代码,但无法编译.
这些是我编写的编码示例.
please help me, i need show data searching in datagrid. i have example code but its can''t compile.
These coding examples that I made.
Option Explicit
Dim conn As ADODB.Connection
Dim Rs As ADODB.Recordset
Dim query As String
Sub setConn()
Set conn = New ADODB.Connection
End Sub
Private Sub serachCmd_Click()
Set Rs = New Recordset
Adodc1.RecordSource = " select * from logfile where no_ponsel = '" & textSearch & "'"
Set LogDataGrid.DataSource = Adodc1
'Rs.Open " select * from logfile where no_ponsel = '" & textSearch & "'", conn, adOpenDynamic, adLockOptimistic
If Adodc1.Recordset.EOF Then
MsgBox "Record not found"
Else
LogDataGrid.DataSource = Adodc1 /* in this is error and message appear "method and data number not found"
LogDataGrid.Refresh
End If
End Sub
请帮助我..thanks
please help me..thanks
推荐答案
您需要更改标记的行.在行的开头添加设置".请参阅该过程顶部附近的一行,您正在做完全相同的事情.
You need to change the line you flagged. Add "Set" to the beginning of the line. See the line near the top of that procedure where you''re doing the exact same thing.
它仍然无法编译.
我需要在datagrid中查看
从日志文件中选择*,其中no_ponsel =''&searchtext.text&"'';
但出现消息错误.
its still cannot compile.
im need to view in datagrid
select * from logfile where no_ponsel = ''" & searchtext.text & " '';
but apear message error.
这篇关于在datagrid中显示数据视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文