错误内容类似:
"Access violation read address 0000000, read of address ffffffff"环境:
BDE联接paradox表,中文表名,中文字段使用query        Close;
        Unprepare;
        DatabaseName := DataPath;
        SQL.Clear;
        SQL.ADD('Select 编码 From 客户编码 Where 编码='''+cCode+'''');
        Prepared := True;
        ExecSQL;
        Open;发生错误。

解决方案 »

  1.   

    DatabaseName := DataPath;
    Close;
    SQL.Clear;
    SQL.ADD('Select 编码 From 客户编码 Where 编码='''+cCode+'''');
    //ExecSQL;//不能用与open操作
    Open;
      

  2.   

    up
    而且你没有用parameter,没有什么必要prepare
      

  3.   

    Close;
            Unprepare;
            DatabaseName := DataPath;
            SQL.Clear;
            SQL.ADD('Select 编码 From 客户编码 Where 编码='''+cCode+'''');
            Prepared := True;
            Open;//这和SELECT合用,对于不用返回结果集的(INSERT ,UPDATE)用EXECSQL
      

  4.   

    Close;
            DatabaseName := DataPath;
            SQL.Clear;
            SQL.ADD('Select 编码 From 客户编码 Where 编码='''+cCode+'''');
            Open;这样我也用过,还是错的。
      

  5.   

    是不是你的引号使用不正确而且这里应使用open
      

  6.   

    是引号问题,ccode是字符串。

    SQL.ADD('Select 编码 From 客户编码 Where 编码=''+cCode+''');
    出错

    SQL.ADD('Select 编码 From 客户编码 Where 编码=:cCode');
    出错
      

  7.   

    先用TABLE试试,如果没问题就说明DATABASE没连错
    再换成QUERY
    with query do
    begin
            Close;
            SQL.Clear;
            SQL.ADD('Select 编码 From 客户编码 Where 编码='''+cCode+'''');
            Open;
    end;
      

  8.   

    TABLE没有问题的。只是先用query先check是否存在数据,如不存在则打开table,append;queryclient 和 tableclient 指向的是同一个表。  With SysDataModule.QueryDrpClient Do
      begin
        Close;
        SQL.Clear;
        SQL.ADD('Select cHelpCode From vClient');
        Open;
        First;
        While Not Eof Do
        begin
          cHelpCode := FieldByName('cHelpCode').AsString;
          With SysDataModule.QueryClient Do
          begin
            Close;
            DatabaseName := DataPath;
            SQL.Clear;
            SQL.ADD('Select 编码 From 客户编码 Where 编码='''+cHelpCode+'''');
            Open;
    ////////////错误在这里
            First;
            If Eof Then          //加入数据
            Begin
              With SysDataModule.TableClient Do
              begin
                Close;
                Open;
                Edit;
                Append;
                  FieldByName('编码').AsString := SysDataModule.QueryDrpClient.FieldByName('cHelpCode').AsString;
                Post;
                n := n + 1;
                Close;
              end;
            end;          //加入数据
          close;
          end;
          m:=m+1;
          Next;
        end;
      Close;
      end;
      

  9.   

    菜鸟相问:ExecSQL与 Open两个命令有什么区别?
      

  10.   

    Close;
    Unprepare;
    DatabaseName := DataPath;
    SQL.Clear;
    SQL.ADD('Select 编码 From 客户编码 Where 编码='''+cCode+'''');
    Prepared := True;
    Open;
      

  11.   

    select --open
    insert, delete, update-----ExecSQL