回 帖 发 新 帖 刷新版面

主题:[讨论]求助:关于delphi的调试问题

在编写一个数据库连接模块时,调试出现下面的提示
project jianyan.exe raised exception class EOleException with message
'找不到可安装的ISAM.'Process stopped .Use Step or Run to continue.
                 OK                 HELP
  View CPU Window(前面有个复选框)
请各位指教,多谢了

回复列表 (共2个回复)

沙发

估计是你的数据库连接有问题,你把连接代码贴出来看看。

板凳

多谢了,下面是触发连接的代码,请帮忙看看吧
procedure Tconnect.BtnconnectClick(Sender: TObject);
var PathStr:string;  //用来接收输入的路径和名称
begin
  try
  Screen.Cursor:=crAppStart;
  Application.ProcessMessages;
  ADOConnection1.Close;
  ADOQuery1.Close;
  ADOQuery1.Active:=False;
  if Trim(ComboBox1.Text)<>'' then
      begin
        ///Session.GetAliasNames(ComboBox1.Items);

        ADOConnection1.LoginPrompt:=false;  //去除登录密码验证窗口
        try
        if Trim(ComboBox1.Text)='Microsoft Access' then    //要指明文件
          begin
            ADOConnection1.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0.1;Password='+EPass.Text+';Persist Security Info=True;User ID='+EUser.Text+';Extended Properties="DSN=MS Access Database;DBQ='+EDatabaseFile.text+';DefaultDir='+ExtractFilePath(EDatabaseFile.text)+';DriverId=25;MaxBufferSize=2048;FIL=MS Access;PWD='+EPass.Text+';UID='+EUser.Text+';"';
          end
        else
        if Trim(ComboBox1.Text)='Microsoft Excel' then    //要指明文件
          begin
            ADOConnection1.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+EDatabaseFile.text+';Persist Security Info=False;Jet OLEDB:Database Password='+EPass.text+';Mode=Share Deny None;Extended Properties=Excel 8.0;';
          end
        else
        if Trim(ComboBox1.Text)='Paradox7.0'  then     //要指明文件
          begin
            ADOConnection1.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+EDatabaseFile.text+';Persist Security Info=False;Jet OLEDB:Database Password='+EPass.text+',Mode=Share Deny None;Extended Properties=paradox 7.x';
          end
        else
        if Trim(ComboBox1.Text)='dBASE' then    //要指明目录(已处理成可以是文件) 最后不能有'\'
          begin
            ADOConnection1.ConnectionString:='Provider=MSDASQL.1;Password='+EPass.text+';Persist Security Info=True;User ID='+EUser.Text+';Mode=Share Deny None;Extended Properties=DBase 5.0;DBQ='+EDatabaseFile.text+';DefaultDir='+ExtractFilePath(EDatabaseFile.text)+';DriverId=533;MaxBufferSize=2048;PageTimeout=5;"';
          end
        else
        if Trim(ComboBox1.Text)='VFP Datebase *.dbf' then    //要指明目录(已处理成可以是文件) 最后必须有'\'
          begin
            ADOConnection1.ConnectionString:='Provider=MSDASQL.1;Password='+EPass.Text+';Persist Security Info=True;User ID='+EUser.Text+';Extended Properties="DSN=Visual FoxPro Tables;UID='+EUser.Text+';PWD='+EPass.Text+';SourceDB='+EDatabaseFile.text+';SourceType=DBF;Exclusive=No;BackgroundFetch=Yes;Collate=Machine;Null=Yes;Deleted=Yes;"';
          end
        else
        if Trim(ComboBox1.Text)='VFP Datebase *.dbc' then      //一定要指明数据库文件
          begin
            ADOConnection1.ConnectionString:='Provider=MSDASQL.1;Password='+EPass.Text+';Persist Security Info=True;User ID='+EUser.Text+';Extended Properties="DSN=Visual FoxPro Database;UID='+EUser.Text+';PWD='+EPass.Text+';SourceDB='+EDatabaseFile.text+';SourceType=DBC;Exclusive=No;BackgroundFetch=Yes;Collate=Machine;Null=Yes;Deleted=Yes;"';
          end
        else
        if Trim(ComboBox1.Text)='Microsoft SQL Server'     then        //要求IP,数据库 另外就是登陆用户名和密码
          begin
            PathStr:='(Local)';
            if not InputQuery('SQL Server','请输入你要连接到的SQL服务器名或IP            本地可用 (Local) 或 127.0.0.1 ',PathStr) then begin Screen.Cursor:=crDefault; exit; end;
            EDatabaseFile.text:=Trim(PathStr);
            PathStr:='pubs';
            if not InputQuery('数据库选择','请输入你要打开的数据库名,如:pubs      ',PathStr) then begin Screen.Cursor:=crDefault; exit; end;
            ADOConnection1.ConnectionString:='Provider=SQLOLEDB.1;Password='+EPass.Text+';Persist Security Info=True;User ID='+EUser.Text+';Initial Catalog='+PathStr+';Data Source='+EDatabaseFile.text+'';
          end
        else {if (ComboBox1.Items.IndexOf(ComboBox1.Text)<>-1) then} //打开已创建好的数据源
          begin
            ADOConnection1.ConnectionString:='Provider=MSDASQL.1;Password='+EPass.Text+';Persist Security Info=True;User ID='+EUser.Text+';Data Source='+ComboBox1.Text+'';
          end
        ;//else application.MessageBox('所选择的数据库或数据源别名不能被打开,请检查更改后再试!','打开数据库错误',0);
        ADOConnection1.Open;
        Screen.Cursor:=crDefault;
        except
        Screen.Cursor:=crDefault;
        application.MessageBox('连接数据库失败,请检查用户密码和数据库名称路径及是否支持后重试!','打开数据库错误',0);
        end;
      end else
        begin Screen.Cursor:=crDefault; application.MessageBox('没选择数据类型或据源别名','打开数据库错误',0);
          connect.Close;
          exit;
        end;

  except
  showmessage('请重新选择要连接的数据库!')
  end;
end;

我来回复

您尚未登录,请登录后再回复。点此登录或注册