| 发表于:2007-08-22 19:18:27 楼主 |
我的db1。mdb的表fl2里有47个字段: n、zy、z(1)、m1、j(1)、d(1) z(2)、m2、j(2)、d(2) 。。。 z(9)、m9、j(9)、d(9) j()、d()为数值型 执行后,不再出现行集合问题了,出现所需要的记录了, 但是,只显示j(1)字段下所有的记录!其他记录呢? 代码如下: option explicit private conn as adodb.connection private rst as new adodb.recordset private sub command1_click() dim ii, ss, jj as integer dim mysql as string for jj = 1 to 9 mysql = "select [j( " & jj & ")] from fl2 where [z( " & jj & ")]= '银行存款 ' " if conn.EXECute(mysql).eof = false and isnull(conn.EXECute(mysql)(0)) = false then set rst = conn.EXECute(mysql) end if next jj ss = rst.fields.count if rst.bof = true then msgbox "no! " else set datagrid1.datasource = rst for ii = 0 to ss - 1 datagrid1.columns(ii).alignment = dbgcenter datagrid1.columns(ii).width = 1000 next ii datagrid1.allowupdate = false end if end sub private sub form_load() dim constring as string constring = "provider=microsoft.jet.oledb.4.0;persist security info = false; " _ & "data source = " & app.path & "\db1.mdb;jet oledb: " set conn = createobject( "adodb.connection ") with conn .connectionstring = constring .open end with conn.cursorlocation = aduseclient rst.cursorlocation = aduseclient rst.open "select * from fl2 ", conn, adopenkeyset, adlockpessimistic, adcmdtext end sub |
|
|
|
|