New topic: 

Database Not found

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

         Page 1 of 1
   [ 2 posts ]                 Previous topic | Next topic          Author  
Message        Tegwin          Post subject: Database Not foundPosted: Tue Mar 
12, 2013 3:42 pm                         
Joined: Fri Nov 18, 2005 7:26 pm
Posts: 28                Hello, 
I am trying to learn database programming and have run into some issues. 

Essentially I created a database whereby I had used the built in editor within 
RS and the file was created on the desktop (windows).. Problem is when I try 
and use this on the Mac it does not connect, so I tried to add some error 
checking but now its gone wrong, not sure where I am going wrong.  Esssentially 
what I want to do is to open the database from say the app folder where the 
program is running so that it will work in windows and Mac.. I tried to use the 
following code and its not working, I always get the error telling me it cannot 
find the file (I have copied the database file to the Real Studio folder as 
below. 


//Fille the Listbox with information from the dataBASE
Dim dr as new Databaserecord
Dim sql as string
Dim dbFile as FolderItem
Dim db as REALSQLdatabase
db=New REALSQLdatabase
dbFile=Getfolderitem("Real Studio 2012 Release 2.1")
db.DatabaseFile=dbFile
if db.connect then
  
  
  sql = "Select ID, firstname,lastname, email  from people"
  
  dim rs as recordset = database.SQLSelect(Sql)
  
  while not rs.eof
  
  lstpeople.AddRow(rs.Field("ID").StringValue)
  lstpeople.Cell(lstpeople.LastIndex, 1) = rs.Field("FirstName").StringValue
  lstpeople.Cell(lstpeople.LastIndex, 2) = rs.Field("LastName").StringValue
  lstpeople.Cell(lstpeople.LastIndex,  3) =rs.Field("email").StringValue
  rs.MoveNext
  Wend
  
  if db.error then
  MsgBox db.errormessage
  else
  db.SQLExecute("Commit") //no error, save change
  end if
else
  MsgBox "Connection to database failed."
end if

  


Any help would be appreciated   
                             Top                DaveS          Post subject: 
Re: Database Not foundPosted: Tue Mar 12, 2013 3:53 pm                          
       
Joined: Sun Aug 05, 2007 10:46 am
Posts: 4665
Location: San Diego, CA                First off... storing a database in the 
Applications folder is not a good idea....
Secondly.... running the program from the IDE and running it after its compiled 
COULD create totally different locations for "the application"

and I am going on the "assumption" that you actually have created a database, 
and that database DOES have a table called "people" in it...  it the answer is 
NO to either of those statements then that is where you problem starts.      
_________________
Dave Sisemore
MacPro, OSX Lion 10.7.4 RB2012r1
Note : I am not  interested in any solutions that involve custom Plug-ins of 
any kind  
                             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