请问这个程序有什么错误?我是收到一个CT_Pas参数后进行响应~~是不是ADOQuery,ADOConnection的设置有问题?
procedure TForm1.IdUDPServer1UDPRead(Sender: TObject; AData: TStream;
  ABinding: TIdSocketHandle);
var
   DataBlock:TDataBlock;
begin
   AData.ReadBuffer(DataBlock,AData.Size);
   Case DataBlock.iCommand of     CT_Pas:
       begin
        with ADOQuery1 do
         begin
         close;
         SQL.Clear;
         SQL.Add('select * from login where studno=' + '''' + DataBlock.username + ''''+ ' and passwd=' + '''' + DataBlock.password +'''');
         open;
         active:=True;
         end;
         if ADOQuery1.recordcount > 0 then
            begin
          ......

解决方案 »

  1.   

    可能是adoquery1中的recordcount=0的,你没有测试一下是不是为0吗
      

  2.   

    SQL.Clear;
             SQL.Add('select * from login where studno=' + '''' + DataBlock.username + ''''+ ' and passwd=' + '''' + DataBlock.password +'''');
             open;
    在这句话之后,打个断点,将query1.sql.text的内容单独在数据库的sql状态下执行看看结果
      

  3.   

    单步跟踪了一下,发现也不是数据库的问题。好像我的结构体构建得有冲突。
    报的错误是: 
    Access Violation at address 004230BO in Module 'Server.exe'.Read of 
    Address 00000AD.
    是不是我Server端出现什么冲突了??