为什么我的datagrid不能显示数据呢?

tonyathome 2003-01-05 08:58:50
'自定义函数
Private Function ShowDetails(systemno) As Boolean
Dim con As New ADODB.Connection
Dim rst As New ADODB.Recordset
Dim sqlstr As String
Dim constr As String

'建立数据库文件的相对路径
constr = App.Path
If Right(constr, 1) <> "\" Then
constr = constr + "\"
End If
constr = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & constr & "InvoicePrint.mdb"
'打开数据库连接
con.Open constr
'建立查询字符串
sqlstr = "select * from Details where system_no='" & systemno & "'"
'打开数据记录集
rst.Open sqlstr, con, adOpenStatic
If rst.EOF Then
MsgBox "No Details info!"
Else
Set dgrDetails.DataSource = rst
dgrDetails.Visible = True

End If
'关闭数据记录集
rst.Close
'关闭数据库连接
con.Close
End Function
...全文
29 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧