大家知道怎样移动、删除整个目录及怎样给一个目录改名吗? (50分)

  • 主题发起人 主题发起人 chemstar
  • 开始时间 开始时间
C

chemstar

Unregistered / Unconfirmed
GUEST, unregistred user!
大家知道怎样移动、删除整个目录及怎样给一个目录改名吗?
 
ConnectionString设置不对,相应的数据源不存在!
 
估计是你程序里的ADOConnection的Connected属性设成True了,改为False就行了
 
procedure TForm1.FormCreate(Sender: TObject);<br>begin<br>&nbsp; AppPath := ExtractFilePath(Application.ExeName);<br>&nbsp; try<br>&nbsp; &nbsp; ADOConnection1.Close;<br>&nbsp; &nbsp; ADOConnection1.Connected := false;<br>&nbsp; &nbsp; ADOConnection1.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=' +<br>&nbsp; &nbsp; &nbsp; AppPath + '/Guest.mdb;Persist Security Info=False';<br>&nbsp; &nbsp; ADOConnection1.Connected := True;<br>&nbsp; &nbsp; ADOConnection1.Open;
 
to :碧血剑,<br>&nbsp;adoconnection的connected已经为false.<br>to jsxjd, <br>&nbsp; ConnectionString在设计期间根本没有设置,而是运行程序后,根据打开的库的名称动态生成<br>类似以下语句:<br>  if OpenDialog1.Execute then<br>&nbsp; begin<br>&nbsp; &nbsp;datafilename:=OpenDialog1.FileName;//datafilename为数据库名称<br>&nbsp; &nbsp;ADOConnection1.Connected:=false;<br>&nbsp; //动态生成connedtionstring语句:<br>&nbsp; &nbsp;ADOConnection1.ConnectionString:= 'Provider=Microsoft.Jet.OLEDB.4.0;'<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+'User ID=Admin;'+<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;'Data Source='+datafilename+';'<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+'Mode=Share Deny Read|Share Deny Write;'<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+'Persist Security Info=False;'<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+'Jet OLEDB:Database Password=`1123456';<br>&nbsp; &nbsp; ADOConnection1.Connected:=true;<br>&nbsp; end;<br>&nbsp;在程序开始运行时,根本就没有任何连接,也就是不该出错才对。但真是莫名其妙!<br><br>
 
to :孔明.net:<br>&nbsp; &nbsp;我即使把formmain.creat里面的语句全部删掉,也就是说,即使不运行与adoconnection<br>任何有关的语句,也会出同样的错误!真是奇怪!
 
检查你的数据模块中是否在错误的数据连接。
 
在formmain的create中设置断点跟踪是哪里出错罗
 
to 大家:<br>  这个问题我终于自己搞定了,方法很简单:<br>  先建一个空白的项目,然后把原来程序中所有的代码和窗体上控件拷贝到这里面,重<br>新编译,就OK了!<br>  也就是说,我原来的代码中没有任何错误。只是不知犯了哪门子的邪,可能是delphi本身的<br>问题吧。<br>  分照发,但是再提一个问题吧:<br>  大家知道怎样移动、删除整个目录及怎样给一个目录改名吗?
 
哇塞,那也不至于把原来地问题题目删了呀<br>我都没看见呢?<br><br>deletedir,rmdir等几个api函数,help里很好找地
 
多人接受答案了。
 

Similar threads

D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
后退
顶部