New topic: Unable to find problem with deleting or updating SQL data
<http://forums.realsoftware.com/viewtopic.php?t=41302> Page 1 of 1 [ 3 posts ] Previous topic | Next topic AuthorMessageWarpedChild Post subject: Unable to find problem with deleting or updating SQL dataPosted: Thu Nov 03, 2011 10:13 pm Joined: Tue Sep 06, 2011 4:42 pm Posts: 6 I've lifted a couple of examples from the documentation to gain some hands on understanding of using Real Studio to manipulate its built in SQL database. My window consists of a listbox, and three pushbuttons. One is an "add" button that creates a db.rsd file in the first place, the second is a "read" button which opens the database and displays its contents in the listbox, and the third button is currently a "delete" button which I am trying to make work using code examples from the documentation. Specifically, the following code is in the action event of the delete button. Dim dbFile as FolderItem Dim db as REALSQLdatabase db=New REALSQLdatabase dbFile= NEW FolderItem("db.rsd") db.databaseFile=dbFile If db.error then MsgBox db.errormessage else db.SQLExecute ("Delete From Employees where name = 'CJB'") If db.error then MsgBox db.ErrorMessage else db.Commit //save deletion MsgBox "Record deleted successfully." end if end if Everything works fine except for the delete button, which returns the msgbox error message, "The operation cannot be completed because the database is closed". By inserting "you are here" msgbox signs I know that the error appears after the SQLExecute command. Any insight would be greatly appreciated. Top DaveS Post subject: Re: Unable to find problem with deleting or updating SQL datPosted: Thu Nov 03, 2011 10:17 pm Joined: Sun Aug 05, 2007 10:46 am Posts: 3279 Location: San Diego, CA might want to CONNECT to the database before you try to execute any operations If DB.Connect Then _________________ Dave Sisemore MacPro, OSX 10.6.8 RB2011r3 Note : I am not interested in any solutions that involve custom Plug-ins of any kind Top WarpedChild Post subject: Re: Unable to find problem with deleting or updating SQL datPosted: Thu Nov 03, 2011 10:33 pm Joined: Tue Sep 06, 2011 4:42 pm Posts: 6 Hahah... so obvious once you point it out. Thanks. Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 3 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]
