< >又来麻烦大家了,有以下程序:</P>5 U$ c: Q/ r6 z8 X. F, h' {
< >void __fastcall TForm1::N14Click(TObject *Sender)
8 U. e' y) q6 E8 i. F* z{
8 c- {& Y2 c, u7 i9 S# t, A int nScore;$ Y C2 u# G$ V- g$ m- K F& a
AnsiString strScore=InputBox("请输入费率区","请输入费率区","");$ |& E2 l0 o8 Y, _4 Q( z
if(strScore ==""), B! L* P7 u1 B6 k$ y
return;" W% n: J! Q" ]- v
nScore=StrToInt(strScore);, i$ V/ E5 h/ b' f# [( b
if(nScore<790||nScore>799)
" }; F2 Y, y% g* @ {1 w9 x5 l% j c
ShowMessage("数据输入错误!");
. m( j" R3 U0 m8 W9 u6 W return;% f* c. H1 x. o- J! x
}, V7 H; h' y. V
. X! s5 ?* y' ?5 U) b" J}</P>1 H' q) t/ y1 X: |
< >这个主要是要求使用程序者输入它所在的费率区,输入到strScore中,第二段程序:</P>% q. F% I; W/ B2 I
< > ADOQuery1->Close();* ^- `) S3 K6 a3 g
ADOQuery1->SQL->Clear();0 l4 ~/ o$ l# u- ], W
ADOQuery1->SQL->Add("SELECT * FROM jxprm.group_info WHERE group_city='strScore'");
" b# A& C0 O( H0 N" A ADOQuery1->Open();</P>
: W1 [! w4 ]5 H5 B/ l9 P# D! W, Y< >将得到的值代入程序,但是编译没有问题,使用了的时候显示“无效的数字”,初步判断是全局变量的问题,现修改头文件</P>
6 D: L- d1 r) V5 z% D) \+ k< >//---------------------------------------------------------------------------</P>/ }& f1 z0 P; }4 @, G- {* h
< >#include <vcl.h>: w, @2 e) K# ]+ U* Q
#pragma hdrstop</P>
# n+ E0 W! q# ]/ w7 n< >#include "Unit3.h". e5 A8 t- s" t7 l4 p
//---------------------------------------------------------------------------
% j2 x+ `5 G/ }3 A, Z. Y; L#pragma package(smart_init)/ J. Z3 p/ x9 v( L: r" M( G
#pragma resource "*.dfm"
2 ?9 R, T0 B7 o" j: ^TForm1 *Form1;
1 V; H: D3 E2 _* x, E$ n; K+ F f1 kint nScore;$ o6 l |- |! r6 P) ^' g7 ~
AnsiString strScore;</P>$ p9 Y7 _, }& }! q; I
< >结果还是老样子,请大家帮忙看一下,谢谢!</P>2 m5 V( U) e) F5 G) }( Z+ b$ X' S3 ^9 |
[此贴子已经被作者于2004-7-30 10:22:25编辑过] |