如何对MSHFlexgrid控件中的内容进行查询
如何对MSHFlexgrid控件中的内容通过combox控件进行查询,求指教,谢谢了
程序代码:
Option Explicit Dim conn As New ADODB.Connection Dim rs1 As New ADODB.Recordset Dim rs2 As New ADODB.Recordset Dim Str1 As String Dim Str2 As String Dim Str3 As String Dim strSQL As String Private Sub Combo1_Click() strSQL = "select * from 表1 where 备注=" & "'" & Combo1.Text & "'" '表1换为找开的表名,备注换为要查询的字段名 rs2.Open strSQL, conn, 1, 1 Set MSHFlexGrid1.DataSource = rs2 rs2.Close End Sub Private Sub Form_Load() Str1 = "Provider=Microsoft.Jet.OLEDB.4.0;" Str2 = "Data Source=c:\test.mdb;" '数据据文件路径及文件名 Str3 = "Jet OLEDB:Database Password=" conn.Open Str1 & Str2 & Str3 strSQL = "select * from 表1 " rs1.Open strSQL, conn, 1, 1 Set MSHFlexGrid1.DataSource = rs1 End Sub一个简单的示例