用的是access数据库
我想先在数据库中搜寻到数据,再将此数据用于程序运算,该怎么做呢?
做好能例举一个实例!!
谢谢!

解决方案 »

  1.   

    在页面添加
    ADOConnection 和 ADOQuery 控件//获取用户
    procedure TForm1.Getuser;
    var
      i:integer;
    begin
      Hash:=THashedStringlist.Create;
      ADOConnection1.ConnectionString:='Provider=SQLOLEDB.1;Password=520156;'
      +'Persist Security Info=True;User ID=xiaoyitest;Data Source=(local);'
      +'Initial Catalog=OAsystem;';
      ADOConnection1.Open;
      ADOQuery1.Connection:=ADOConnection1;
      ADOQuery1.SQL.Clear;
      ADOQuery1.SQL.Add('SELECT youwant1, youwant2 FROM yourtable');
      ADOQuery1.Open;
      for i:=0 to ADOQuery1.RecordCount-1 do
      begin
        Hash.Add(ADOQuery1.Fields[0].Value + '=' + Md5.MD5Print(MD5.MD5String(ADOQuery1.Fields[1].Value)));
        ADOQuery1.Next;
      end;
      //这里通过类似 ADOQuery1.Fields[0].Value 这样的形式获得
      ADOQuery1.Close;
      ADOConnection1.Close;
    end;
      

  2.   

    对了 连接字符串需要修改为 access 的