代码如下:
if edit1.text<>'' then
////////////////有问题/////////////
copyfile(pchar(label3.Caption),pchar(edit1.Text+'salary_Data.MDF'),true);
 其中label3.caption的值为:'D:\salary\data\salary_Data.MDF'
 edit1.Text+'salary_Data.MDF'的值为:选定路径+salary_Data.MDF
用的delphi2005 出现的错误是pchar() expression illegal in evaluator

解决方案 »

  1.   

    就是不能复制文件哈。运行的时候没有报措哈
    我用pchar的时候始终没有正确过哈
      

  2.   

    copyfile(pchar(label3.Caption),pchar(edit1.Text+'salary_Data.MDF'),false);
      

  3.   

    你在C盘放一个最简单的txt文件,例如test.txt
    然后copy(PChar('c:\test.txt'),PChar('d:\test.txt'),false);试试!
      

  4.   

    那就行啦!如果不行就
    var
     dest: PChar;
    begin
      GetMem(dest,Length(Label3.Caption)+1);
      StrPCopy(dest,Label3.Caption);
      Copy(dest,pchar(edit1.Text+'salary_Data.MDF'),False);
      Free(dest);
    end;
      

  5.   

    var s:string;
    s:=edit1.Text+'salary_Data.MDF';
    copyfile(pchar(label3.Caption),pchar(s),false);
      

  6.   

    我狂晕,郁闷死了。终于找到错误在哪里了。原来在运行的时候数据库根本不能复制,我用的是sql2000