如何实现MSFlexGrid根据TEXTBOX输入自动搜索数据库
如何实现在TextBox里面输入字符,MSFlexGrid根据输入字符自动搜索数据库并显示在表格中请教高人指点,谢谢!!
Dim str As String
str = " select * from 会员表 where 会员卡号 like '% " + Text1.text + "%'"
MSFlexGrid1.Cols = 6
MSFlexGrid1.ColWidth(0) = 1500
MSFlexGrid1.ColWidth(1) = 2000
MSFlexGrid1.ColWidth(2) = 2000
MSFlexGrid1.ColWidth(3) = 1500
MSFlexGrid1.ColWidth(4) = 1500
MSFlexGrid1.ColWidth(5) = 1500
Dim temp As Integer
Dim i, j As Integer
Dim re As New ADODB.Recordset
re.Open str, conn, 1, 3
MSFlexGrid1.Rows = re.RecordCount + 1
For i = 1 To re.RecordCount
Me.MSFlexGrid1.Row = i
For j = 0 To 5
MSFlexGrid1.Col = j
MSFlexGrid1.Text = re(j)
Next j
re.MoveNext
Next
re.Close
End Sub