当前位置:首页
开发技术指南» 文章正文
    引言:
 

 

 ·出个主意    »显示摘要«
    摘要: 我在太原,月薪平均4k,如果去外地,多少钱合适? ......
    摘要: 我编写了更新数据库的程序,运行时出现错误 c:\apache group\tomcat 4.1\work\standalone\localhost\_\mywork\do_option_jsp.java:151: incompatible types found : int required: java.sql.resultset resultset rr=st.executeupdate......


谁能告诉我这是怎么回事分不够可以再加。

下面这段程序如果先按Button2再按Button1就会出错,反过来就没事。  
  怎么解决呢?请大家帮我。  
   
   
  unit   Unit1;  
   
  interface  
   
  uses  
      Windows,   Messages,   SysUtils,   Variants,   Classes,   Graphics,   Controls,   Forms,  
      Dialogs,   StdCtrls,   ExtDlgs;  
   
  type  
      TPict   =   Record  
            PicName:   string[255];  
            Height:   integer;  
            Width:   Integer;          
  end;  
   
  type  
      TForm1   =   class(TForm)  
          Button1:   TButton;  
          Button2:   TButton;  
          OpenPictureDialog1:   TOpenPictureDialog;  
          procedure   FormCreate(Sender:   TObject);  
          procedure   Button1Click(Sender:   TObject);  
          procedure   Button2Click(Sender:   TObject);  
      private  
          {   Private   declarations   }  
      public  
          {   Public   declarations   }  
      end;  
   
  var  
      Form1:   TForm1;  
      aPict:   TPict;  
      PictFile:   file   of   TPict;  
  implementation  
   
  {$R   *.dfm}  
   
  procedure   TForm1.FormCreate(Sender:   TObject);  
  begin  
            AssignFile(PictFile,Temp.dat);  
            Rewrite(PictFile);  
            CloseFile(PictFile);  
  end;  
   
  procedure   TForm1.Button1Click(Sender:   TObject);  
  begin  
            AssignFile(PictFile,Temp.dat);  
            FileMode   :=   fmOpenReadWrite;  
            Reset(PictFile);  
            Seek(PictFile,0);  
            aPict.PicName   :=   2222;  
            aPict.Height   :=   10;  
            aPict.Width   :=   10;  
            Write(PictFile,aPict);  
            CloseFile(PictFile);  
  end;  
   
  procedure   TForm1.Button2Click(Sender:   TObject);  
  begin  
  if   OpenPictureDialog1.Execute   then  
      begin  
      end;  
  end;  
   
  end.

NO.1   作者: linzhisong

AssignFile(PictFile,application.ExeName+Temp.dat);

NO.2   作者: u2m

OpenPictureDialog1执行后改变了程序的相对路径,你改成绝对路径就没问题

NO.3   作者: smilelhh

OpenPictureDialog1.execute后改变了当前目录路径。  
  AssignFile(PictFile,Temp.dat)要改成  
  AssignFile(PictFile,Extractfilepath(Application.exename)+Temp.dat);

NO.4   作者: sblsongdongf

1)调用各类标准对话框后,程序的当前路径CurrentDir都被改变为对话框  
  选中的路径。也就是说,当前路径与应用程序的所在路径不是一个概念.  
  2)AssignFile的第2个参数---文件名,最好加上相对路径.

NO.5   作者: fyje

我感觉不是上面说的问题,问题是,你的button2的行为可能改变了参数的值,使得文件名改变而找不到要打开的文件造成的,最好在button2click事件中具有容错性,即发生错误时,参数恢复到create时的状态


    摘要: 假设有一个动态链接库mydll.dll,其中包含一个导出函数myfunc(int, int)。 在asp中如何加载mydll.dll,并且使用myfunc函数? ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE