我想用 delphi做普通登陆业面,数据库连上后代码运行不了,请高手指点,给我点代码,别笑我菜,呵呵

解决方案 »

  1.   

    var
    a,b,c:string;
    begin
    a:=n.text;
    b:=n1.text;
    c:=n2.text;
    if (a='')and(b='') then
    messagebox(handle,'密码不能为空',nil,MB_OK)
    else
    begin
    ADOQuery1.Close;
    ADOQuery1.SQL.Clear;
    ADOQuery1.SQL.add('select*from T_zuce where passwod=a and id=c');
    ADOQuery1.open;
    if id<>a or password<>c then
    messagebox(handle,'用户或密码名无效',nil,MB_OK)
    else
    ADOQuery1.SQL.add('uptate T_zuce password=''b'' where id=''c''');ADOQuery1.ExecSQL;
    messagebox(handle,'修改成功',nil,MB_OK)
    end;
    end;end.
    不能运行   高手指点下啊   最好给点代码
      

  2.   

    'uptate T_zuce password=''b'' where id=''c'''
    ------->
    'uptate T_zuce set password=''b'''+ ' where id=''c'''
      

  3.   

    uptate---->update'select*from T_zuce where passwod=a and id=c'
    -------->
    'select * from T_zuce where passwod=''a'''+' and id=''c'' '
      

  4.   

    var
    a,b,c:string;
    begin
    a:=n.text;
    b:=n1.Text;
    c:=n2.Text;
    if (a='')or(b='')or(c='')  then
    messagebox(handle,'帐号或密码不能能为空',nil,MB_OK)
    else
    begin
    ADOQuery1.Close;
    ADOQuery1.SQL.Clear;
    ADOQuery1.SQL.add('select*from T_zuce where password=''n.text'''+' and id=''n2.text''');
    ADOQuery1.open;
    ADOQuery1.SQL.add('update T_zuce set password=''n1.text''  where id=''n2.text''');
    ADOQuery1.ExecSQL;
    messagebox(handle,'修改成功',nil,MB_OK);
    end;
    这样可以运行  可是密码改不掉的   无效的   为什么啊 再告诉我啊
      

  5.   

    'select*from T_zuce where passwod=a and id=c'
    这句话写错了
    改成
    'select*from T_zuce where passwod='''+a+''' and id='''+c+'''';
      

  6.   

    //---你真应当好好去看一看代码规范再编码!var
    a,b,c:string;
    begin
    a:=n.text;
    b:=n1.text;
    c:=n2.text;
    if (a='')and(b='') then
       messagebox(handle,'密码不能为空',nil,MB_OK)
    else
    begin
     with adoquery1 do begin
    Close;
    SQL.Clear;
    SQL.add('select*from T_zuce where passwod='''+a+''' and [id]='''+c+'''');
    open;
    if fieldbyname('id').asstring<>a or fiebyname('password').asstring<>c then
    messagebox(handle,'用户或密码名无效',nil,MB_OK)
    else 
      begin
    close;
    sql.clear;
    SQL.add('uptate T_zuce password='''+b+''' where id='''+c+'''');
    ExecSQL;
    messagebox(handle,'修改成功',nil,MB_OK);
      end;
    end;
    end;
    end;end.