功能创建一个名为KillReport的ODBC名,可是,按照下面的函数,我创建完了后,不能读取数据。可是要是我手动创建就可以了。为什么阿?哪位以前做过这个方面的,帮我看看,错在那里?如果有例子可以给我参考一下,谢谢。function CreatedBaseOdbc:boolean;
var
  registertemp:Tregistry;
  //bData : array[ 0..0 ] of byte;
begin
  result:=false;
  registerTemp := TRegistry.Create;
  with registerTemp do
   begin
      //设置根键值为HKEY_LOCAL_MACHINE
      //找到Software\ODBC\ODBC.INI\ODBC Data Sources
      RootKey:=HKEY_LOCAL_MACHINE;
      if OpenKey('Software\ODBC\ODBC.INI\ODBC Data Sources',True) then
         begin //注册一个DSN名称
            WriteString( 'KillReport', 'Microsoft dBase Driver (*.dbf)' );
         end
      else
         begin
            //创建键值失败
            result:=false;
            exit;
         end;
      CloseKey;      //找到或创建Software\ODBC\ODBC.INI\KillReport,写入DSN配置信息
      if OpenKey('Software\ODBC\ODBC.INI\KillReport',True) then
           begin
               WriteString( 'DefaultDir',extractfilepath(application.exename)+'DB' );//数据库目录,连接您的数据库
               //WriteString( 'Description','' );//数据源描述
               if  fileexists('c:\WINNT\System32\odbcjt32.dll') then
                         WriteString( 'Driver', 'c:\WINNT\System32\odbcjt32.dll' ) //驱动程序DLL文件
                    else
                         WriteString( 'Driver', 'D:\WINNT\System32\odbcjt32.dll' );//驱动程序DLL文件
               WriteInteger( 'DriverId', 277);
              //驱动程序标识
               WriteString( 'FIL', 'dBase IV;' );
               //Filter依据
               writeInteger( 'SafeTransaction', 0 );
               //支持的事务操作数目
               //WriteString( 'UID', '' );//用户名称
               //非独占方式
               //bData[0] := 0;
               //WriteBinaryData( 'Exclusive', bData, 1 );
               //非只读方式
               //WriteBinaryData( 'ReadOnly', bData, 1 );           end
         else
           begin
               //创建键值失败
               result:=false;
               exit;
           end;
      CloseKey;      //找到或创建Software\ODBC\ODBC.INI\KillReport\Engines\Xbase
      //写入DSN数据库引擎配置信息
      if OpenKey('Software\ODBC\ODBC.INI\KillReport\Engines\Xbase',True) then
          begin
              WriteString('CollatingSequence','ASCII');
              WriteString( 'ImplicitCommitSync', '' );
              //WriteInteger( 'PageTimeout', 10 );//页超时
              WriteInteger( 'Threads', 3 );//支持的线程数目
              WriteString( 'UserCommitSync', 'Yes' );
              //WriteInteger( 'MaxBufferSize', 512 );//缓冲区大小
              WriteString('Statistics','0');
              WriteString('Deleted','1');
          end
        else
          begin
              //创建键值失败
              result:=false;
              exit;
           end;
      CloseKey;
       Free;
      end;
  result:=true;end;