try
     con1.ConnectionString:=('DRIVER={MySQL ODBC 3.51 Driver};'+
                    'SERVER=localhost;'+
                    'DATABASE=test;'+
                    'USER=root;'+
                    'PASSWORD=root;'+
                    'OPTION=3;');
     con1.Close;
     con1.Open;

     qry1.SQL.Clear;
     qry1.SQL.Add('Select * from user');
     qry1.Open;
  except
        application.MessageBox('无法连接数据库服务器.请与管理员联系','提示',MB_ICONINFORMATION);
  end;

Last modification:August 16th, 2009 at 12:30 pm
如果觉得我的文章对你有用,请随意赞赏