| 发表于:2007-05-25 18:36:01 楼主 |
我用vb6.0 见sql2000写了一个实时显示数据的程序,屏幕输出是用print输出的, 代码如下: timer1 用来控制屏幕显示和刷新的,lm02是个下拉列框,用来选着显示的组别,但我每次选下拉条目时,显示过程中,我关闭窗体都没有响应,是怎么回事呀. private sub timer1_timer() timer1.interval = 11000 cls currenty = 100 print dim i as integer dim j as integer dim time_start, time_end set rs = new adodb.recordset on error resume next with rs .activeconnection = conn .cursorlocation = aduseclient .cursortype = adopenkeyset .locktype = adlockoptimistic .open "select *,left(lm05,19)lm05part1,isnull(substring(lm05,20,26), ' ') lm05part2 from lmp " _ & " where lm01 like ' " & trim(lm01.caption) & "% 'and lm06= ' " & trim(lm06.caption) & " ' " _ & "group by lm01,lm02,lm03,lm06,lm04,lm05,lm07,lm08,lm09,lm10,lm11,lm12,lm13,lm14,lm15,lm16,lm17,lm18,lm19 " end with i = 0 if rs.eof = true then 'èç¹ûµ±ç°×é±ðµä¼çâ¼îª¿õ,µè´ý3ãë½øèëïâò»¸ö×é±ð set rs = nothing timer1.interval = 3000 exit sub else rs.movefirst end if 'êä³öêý¾ý do while rs.eof = false if i > 6 then ' ò»´îêä³ö7ìõêý¾ýê±, µè´ý11ãëôùë¢ðâïôê¾ïâãæµä¼çâ¼ time_start = time time_end = dateadd( "s ", "11 ", time_start) delay: lbltimer.caption = datediff( "s ", time, time_end) if lbltimer.caption = 0 then i = 0 cls currenty = 100 print else goto delay end if end if font.size = 17 font.bold = true print tab(1); rs!lm04; tab(12); rs!lm08; tab(23); rs!lm09; tab(32); rs!lm11; tab(42); rs!lm13; tab(52); rs!lm15; tab(61); rs!lm17, print tab(1); rs!lm05part1; tab(23); rs!lm10; tab(32); rs!lm12; tab(42); rs!lm14; tab(52); rs!lm16; tab(61); rs!lm18; tab(71); rs!lm19, print tab(1); rs!lm05part2 if i < 7 then print "-------------------------------------------------------------------------------------------------------------------- " end if rs.movenext i = i + 1 loop 'µ±ò»¸ö×é±ðµä¼çâ¼ïôê¾íêòôºó,µè´ý11ãë½øèëïâò»¸ö×é±ðµäïôê¾ if rs.eof = true then time_start = time time_end = dateadd( "s ", "11 ", time_start) delaytow: lbltimer.caption = datediff( "s ", time, time_end) if lbltimer.caption = 0 then i = 0 cls currenty = 100 '¶¨î»êä³öî»öã print timer1.interval = 3000 exit sub else goto delaytow end if set rs = nothing end if end sub |
|
|
|
|