New topic: 

Cannot locate database file during Run

<http://forums.realsoftware.com/viewtopic.php?t=36304>

         Page 1 of 1
   [ 2 posts ]                 Previous topic | Next topic          Author  
Message        vickiwatson          Post subject: Cannot locate database file 
during RunPosted: Sat Nov 13, 2010 12:19 am                                 
Joined: Mon Nov 01, 2010 5:38 pm
Posts: 2
Location: Ohio                I'm creating my first RealStudio app (RS 2010 
release 4, Windows 7)

I have the code below in the App open event. If I build the project to an .exe, 
the database opens correctly, but if I run it from the IDE, it cannot find the 
database file. I'm not sure what I am doing wrong.

In Build Settings, I have Use "Builds" folder unchecked. I have my project .rbp 
file and the database file in the same folder (which is also where the built 
application is going)

  Dim bError as Boolean = False
  Dim sError As String = ""
  
  dbFile=New REALSQLdatabase
  dbFile.DatabaseFile = GetFolderItem("dbfilename.db3")
  
  If dbFile.DatabaseFile.Exists then
   if Not dbFile.Connect Then
  bError = True
  sError = "Connect Error"
  end
  else
  bError = True
  sError = "File Doesn't Exist"
  end
  
  if bError then
  MsgBox "Error opening data file." + EndOfLine + sError
  Quit
  end      
_________________
V-Web Web Design  
                             Top                 timhare          Post subject: 
Re: Cannot locate database file during RunPosted: Sat Nov 13, 2010 12:52 am     
                    
Joined: Fri Jan 06, 2006 3:21 pm
Posts: 8681
Location: Portland, OR  USA                When you run from the IDE, the debug 
build is not in the same location as the project and the database file.  Try 
this:
Code:if DebugBuild then
  dbFile.DatabaseFile = GetFolderItem("").Parent.Child("dbfilename.db3")
else
  dbFile.DatabaseFile = GetFolderItem("dbfilename.db3")
end
   
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 2 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to