首先在interface下定义
 
const
      ODBC_ADD_DSN                 =   1;
      ODBC_CONFIG_DSN           =   2;
      ODBC_REMOVE_DSN           =   3;
      ODBC_ADD_SYS_DSN         =   4;
      ODBC_CONFIG_SYS_DSN   =   5;
      ODBC_REMOVE_SYS_DSN   =   6;
type
        procedure Button2Click(Sender: TObject; var Key:Word;Shift:TShiftState);
function   SQLConfigDataSource(hwndParent:   Integer;
      fRequest:   LongInt;   lpszDriverString:   string;
      lpszAttributes:   string):   LongBool; 
然后在implementation中写代码 
function   SQLConfigDataSource(hwndParent:   Integer;
      fRequest:   LongInt;   lpszDriverString:   string;
      lpszAttributes:   string):   LongBool;   stdcall;   external   'ODBCCP32.DLL';procedure TForm1.Button2Click(Sender: TObject; var Key:Word;Shift:TShiftState);
 const
      BoolStr:   array[Boolean]   of   string   =   ('f',   't');
begin
       if   Key   <>   VK_RETURN   then   Exit;
      Caption   :=   BoolStr[SQLConfigDataSource(0,ODBC_ADD_SYS_DSN,//  ~换成Handle就是手工配置
  'MS Execl Database',                                              //数据库类型
  'DSN=MS Execl Database'#0   +                                     //数据源名称
  'Server=(local)'#0   +                                            //SQL   Server服务器名
  'Database=C:\Documents and Settings\panyf\桌面\修改记录_FM32.xls'#0   +               //数据库名称
  'Description=动态配置ODBC'#0                 //描述
          )];
end;     
这样就应该把名为MS Execl Database的ODBC配置好了吧,数据源是'Database=C:\Documents and Settings\panyf\桌面\修改记录_FM32.xls',可是我按Button2没有反应呢,编译通过了,帮我看下是什么问题吧