我创建的是ActiveXform窗体,为了在ie下可以浏览
用interbase建一个表PERSON :ID,PASSWD
我用的Tquery控件,属性都设置了procedure TActiveFormX.Button1Click(Sender: TObject);
var
passwd:string;
begin
DataBase1.Connected:=True;
passwd:=Edit2.Text;
passwd:=Copy(passwd+passwd,1,10);
passwd:=Encrypt(passwd,123);
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('select COUNT(ID)from PERSON where ID=:USER and PASSWD=:PASSWD');
Query1.Params.ParamValues['USER']:=MaskEdit1.text;
Query1.Params.ParamValues['PASSWD']:=passwd;
Query1.Open;
if  Query1['COUNT']=1 then
begin
MaskEdit1.Enabled:=False;
Edit2.Enabled:=false;
Button1.Enabled:=false;
Button3.Enabled:=true;
PageControl1.Enabled:=true;
table1.Filter:='ID='''+MaskEdit1.Text+'''';
table1.Filtered:=true;
table1.Open;
end
else
begin
 Application.MessageBox('请确认用户名和密码,注意大小写!','认证失败',MB_OK);
 DataBase1.Connected:=false;
end;
Query1.Close;
end;当我在IE下浏览时候,出现的错误是:
General SQL error.
arithmetic exception,numeric overflow,or string truncation;

解决方案 »

  1.   

    将此句:Query1.SQL.Add('select COUNT(ID)from PERSON where ID=:USER and PASSWD=:PASSWD');
    该为:
    Query1.SQL.Add('select COUNT(ID)from PERSON where ID=:USER and '+
                     'PASSWD=:PASSWD');
      

  2.   

    用TIBQuery试一试吧。
    另外检查一下数据库,字段类型是否正确。
      

  3.   

    在数据库中ID和PASSWD都是char
    在Tquery中设置为 string
      

  4.   

    我登陆时候用passwd:=Copy(passwd+passwd,1,10);
                passwd:=Encrypt(passwd,123);  //加密
    那修改密码的时候还是用passwd:=Copy(passwd+passwd,1,10);
                           passwd:=Encrypt(passwd,123);
       进行加密吗?
    在这个程序里面,在登陆的时候我把这个加密程序去掉,就可以登陆了
    不知道为什么???
    Encrypt已经事先定义好了