您的位置:程序门 -> vb -> 数据库(包含打印,安装,报表)



在对应所需名称或序数的集合中,未找到项目


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


在对应所需名称或序数的集合中,未找到项目
发表于:2008-01-22 19:44:14 楼主
private   sub   hedui_click()
dim   conn   as   adodb.connection
dim   rst   as   adodb.recordset
dim   atemp(3,   27)   as   string
dim   ntemp(3,   27)   as   string
dim   i%,   j%


set   conn   =   new   adodb.connection
conn.cursorlocation   =   aduseclient
conn.open   "provider=microsoft.jet.oledb.4.0;data   source="   &   app.path   &   "\biaozhun.mdb"
set   rst   =   new   adodb.recordset
set   rst.activeconnection   =   conn

i   =   0
            if   biaozhun1.text   <>   ""   then
            rst.open   "select   *   from   biaozhun   where   steelgrade='"   &   steelgrade.text   &   "'   and   biaozhun='"   &   biaozhun1.text   &   "'"
           
            for   j   =   2   to   rst.fields.count   -   1
                if   ltrim(rst.fields(j))   <>   ""   then
                atemp(i,   j   /   2   -   1)   =   rst.fields(j)
                end   if
                j   =   j   +   1
                if   ltrim(rst.fields(j))   <>   ""   then
                ntemp(i,   (j   -   1)   /   2   -   1)   =   rst.fields(j)
                end   if
            next   j
      rst.close
      end   if

set   rst=nothing
set   conn=nothing
end   sub
发表于:2008-01-23 00:02:301楼 得分:0
給出代碼來問問題,是好的。
但,再建議說明哪里的錯誤。

看來是fields的索引有誤,你詳細調試看看每個索引是否正確。
发表于:2008-01-23 08:38:032楼 得分:0
代码中的表名或字段名与数据库中的表名或字段名不对应
发表于:2008-01-23 08:59:163楼 得分:0
vb.net code
for j = 2 to rst.fields.count - 1 if ltrim(rst.fields(j)) <> "" then atemp(i, j / 2 - 1) = rst.fields(j) end if j = j + 1 '显然这里增加的话会使得下面fields(j)越界 if ltrim(rst.fields(j)) <> "" then ntemp(i, (j - 1) / 2 - 1) = rst.fields(j) end if next j


快速检索

最新资讯
热门点击