| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 648 人关注过本帖
标题:急救,忙帮找错
只看楼主 加入收藏
vb菜鸟
Rank: 1
等 级:新手上路
帖 子:61
专家分:0
注 册:2005-4-26
收藏
 问题点数:0 回复次数:4 
急救,忙帮找错

请各位大师帮忙找错, 模块中定义如下: Public g_ws As Workspace Public g_db As Database Public g_rs As Recordset Public g_strSql As String 程序中定义了一个initdatagrid函数,内容如下: Public Function initdatagrid(blnrenew As Boolean) Dim strdatasource As String Dim intcount As Integer Dim strreaderid As String If blnrenew = False Then strreaderid = txtreaderid.Text Else strreaderid = txtreaderidrenew.Text End If strdatasource = "select lentinfo.读者编号,readerinfo.读者姓名,lentinfo.图书编号," _ & "bookinfo.图书名称,booktype.图书编号,bookinfo.出版社,bookinfo.图书页码,lentinfo.借阅日期," _ & "lentinfo.还书日期,lentinfo.超出天数,lentinfo.罚款金额 from readerinfo,bookinfo,lentinfo,booktype" _ & "where readerinfo.读者编号=lentinfo.读者编号 and bookinfo.图书编号=lentinfo.图书编号 and " _ & "lentinfo.读者编号='" & strreaderid & "'and booktype.类别代码 and lentinfo.还书日期 is null " Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\vb-sql實例\图书管理系统\图书馆查询管理系统.mdb;Persist Security Info=False" Adodc1.CursorLocation = adUseClient Adodc1.CommandType = adCmdTable Adodc1.RecordSource = strdatasource Adodc1.Refresh If blnrenew = False Then Set dtgrdLendBook.DataSource = Adodc1 dtgrdLendBook.Refresh lbllendcount.Caption "所借图书:" + CStr(Adodc1.Recordset.RecordCount) g_strSql = "select * from basicset" Set g_rs = g_db.OpenRecordset(g_strSql) intcount = g_rs!借出册数 - Adodc1.Recordset.RecordCount lblremain.Caption = CStr(intcount) Else Set dtgrdLendBookRenew.DataSource = Adodc1 dtgrdLendBookRenew.Refresh End If End Function

Private Sub txtreaderidrenew_KeyPress(KeyAscii As Integer) If KeyAscii = "13" And txtreaderidrenew.Text <> "" Then g_strSql = "select * froom readerinfo where 读者编号='" & txtreaderidrenew.Text & "'" Set g_rs = g_db.OpenRecordset(g_strSql) If Not g_rs.EOF Then txtreaderidrenew.Text = g_rs!读者姓名 initdatagrid (True) cmdok.Enabled = True End If Set g_rs = Nothing ElseIf KeyAscii = "13" And txtreaderidrenew.Text = "" Then MsgBox "请输入读者编号", vbOKOnly, "提示" cmdok.Enabled = False End If End Sub 运行中出现了这样的错误:实时错误"13",类型不匹配. Private Sub txtreaderid_KeyPress(KeyAscii As Integer) If KeyAscii = "13" And txtreaderid.Text <> "" Then g_strSql = "select * from readerinfo where 读者编号='" & txtreaderid.Text & "'" Set g_rs = g_db.OpenRecordset(g_strSql) '实时错误"13",类型不匹配. If Not g_rs.EOF Then txtreadername.Text = g_rs!读者姓名 initdatagrid (False) Else MsgBox "没有该读者信息!", vbOKOnly, "提示" txtreaderid.Text = "" End If Set g_rs = Nothing ElseIf KeyAscii = "13" And txtreaderid.Text = "" Then MsgBox "请先输入读者信息!", vbOKOnly, "提示" txtreaderid.Text = "" End If End Sub 烦请各位大师百忙之中帮我看一下,非常感谢!

搜索更多相关主题的帖子: 急救 
2005-05-13 10:05
griefforyou
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:3336
专家分:0
注 册:2004-4-15
收藏
得分:0 
又是ADO和DAO结合,好玩。

天津网站建设 http://www./
2005-05-13 10:37
vb菜鸟
Rank: 1
等 级:新手上路
帖 子:61
专家分:0
注 册:2005-4-26
收藏
得分:0 
好玩什么,帮我解决一下了

2005-05-13 17:23
vb菜鸟
Rank: 1
等 级:新手上路
帖 子:61
专家分:0
注 册:2005-4-26
收藏
得分:0 
怎么回事,没有回

2005-05-19 11:38
chen__han1
Rank: 1
等 级:新手上路
帖 子:256
专家分:0
注 册:2004-9-16
收藏
得分:0 
哎,看不懂。

路漫漫其修远兮 吾将上下而求索!
2005-05-20 12:50
快速回复:急救,忙帮找错
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018802 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved