新手求问一段MSHFlexGrid1代码
Private Sub ComFind_Click()
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim sql As String
Set cn = New ADODB.Connection
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\编程12.7.21\dingdanchaxun.mdb;"
sql = "select * from 订单查询 where 订单号 = ' " & Trim(Text1.Text) & " ' "
Set rs = New ADODB.Recordset
rs.Open sql, cn, adOpenForwardOnly, adLockBatchOptimistic
Set MSHFlexGrid1.Recordset = rs
MSHFlexGrid1.Refresh
rs.Close
cn.Close
Set rs = Nothing
Set cn = Nothing
End Sub
运行以后一点查询按钮,MSHFlexGrid1里面就什么数据都木有了,怎么回事啊?已经折腾一下午一早上了
原谅我没有积分,只能发到非技术区
[解决办法]
应该是没有符合条件的记录,你在数据库中查一下输入的订单号是否存在
[解决办法]