New topic: Database Example question.
<http://forums.realsoftware.com/viewtopic.php?t=37975> Page 1 of 1 [ 11 posts ] Previous topic | Next topic Author Message LazyGator Post subject: Database Example question.Posted: Mon Mar 07, 2011 10:35 am Joined: Mon Mar 15, 2010 2:35 pm Posts: 13 Location: Central Illinois I've just begun my adventure into REALStudio (on Windows). I'm coming from a Visual Studio environment primarily developing in VB.NET. I'm running the Database example that comes with REALStudio Pro. When I run the project I notice that the application does not detect the included database (.rsd) file. The following code instead always creates a new database file that I cannot seem to locate. I set a breakpoint in hopes of seeing where the variable is looking for the database; however, I'm unable to figure out how to view the contents of a REALbasic variable in Debug mode. Is there an easy way to see variable contents when stepping through code? Has anyone run into my situation with this example and figured out why the application is not detecting the included database file? Thanks. Sub Open() // Our application is loading so the first thing that we want to do is // connect to the database. We have a property on the App class that // will hold our database connection and can be accessed from anywhere // in the application. We will only connect to the database once and then // we will continue to use that same connection throughout the entire project. // Create Database Object OrdersDB = New REALSQLDatabase // Set Database File OrdersDB.databaseFile = GetFolderItem("Orders.rsd") // Connect to the database if OrdersDB.databaseFile.exists = true then // The database file already exists, so we want to connect to it. if OrdersDB.Connect() = false then DisplayDatabaseError( false )// there was an error connecting to the database Quit return end if else // The database file does not exist so we want to create a new one. // The process of creating a database will establish a connection to it // so there isn't a need to call Database.Connect after we create it. CreateDatabaseFile end Top swort Post subject: Re: Database Example question.Posted: Mon Mar 07, 2011 11:14 am Joined: Mon May 31, 2010 5:35 am Posts: 671 Code:// Create Database Object OrdersDB = New REALSQLDatabase // Set Database File OrdersDB.databaseFile = GetFolderItem("Orders.rsd") The "GetFolderItem" should be a FolderItem wich is the folder where your ("debug") app runs in. The orders.rsd is located in the RealStudio2010r51/examples/Database Example/ folder. You can try it when you change "GetFolderItem("Orders.rsd") " to "GetOpenFolderItme()" see here: http://docs.realsoftware.com/index.php/GetOpenFolderItem Now you can select the databse trough a folderitem dialog. hope it helps.. _________________ SWORTâ¢, it stands for Secure Web Object Realtime Transfer⢠- Windows Vista AND Linux Ubuntu 10.04 LTS - REAL Studio Enterprise(latest) and WEB Edition(latest) - REAL SQL Server 2009 Source of the Dutch User Groups Top LazyGator Post subject: Re: Database Example question.Posted: Mon Mar 07, 2011 11:58 am Joined: Mon Mar 15, 2010 2:35 pm Posts: 13 Location: Central Illinois SWORT, Changing the code as you suggested helps me know which file I'm working with. In RB is there a way to see the contents of variables as I'm stepping through breakpoints? Thank you. Top swort Post subject: Re: Database Example question.Posted: Mon Mar 07, 2011 12:14 pm Joined: Mon May 31, 2010 5:35 am Posts: 671 LazyGator wrote:SWORT, Changing the code as you suggested helps me know which file I'm working with. In RB is there a way to see the contents of variables as I'm stepping through breakpoints? Thank you. I think you need to use the debugger you can find more information here: http://docs.realsoftware.com/index.php/UsersGuide:Chapter_12:The_Debugger _________________ SWORTâ¢, it stands for Secure Web Object Realtime Transfer⢠- Windows Vista AND Linux Ubuntu 10.04 LTS - REAL Studio Enterprise(latest) and WEB Edition(latest) - REAL SQL Server 2009 Source of the Dutch User Groups Top LazyGator Post subject: Re: Database Example question.Posted: Mon Mar 07, 2011 12:38 pm Joined: Mon Mar 15, 2010 2:35 pm Posts: 13 Location: Central Illinois Never mind on the variable question... I found my answer. Also, the database example does not work as designed. Not sure if it because it's older code or incorrectly designed. Thanks. Top swort Post subject: Re: Database Example question.Posted: Mon Mar 07, 2011 12:51 pm Joined: Mon May 31, 2010 5:35 am Posts: 671 LazyGator wrote:Never mind on the variable question... I found my answer. Also, the database example does not work as designed. Not sure if it because it's older code or incorrectly designed. Thanks. I dont know if it works, ill test it right now.. _________________ SWORTâ¢, it stands for Secure Web Object Realtime Transfer⢠- Windows Vista AND Linux Ubuntu 10.04 LTS - REAL Studio Enterprise(latest) and WEB Edition(latest) - REAL SQL Server 2009 Source of the Dutch User Groups Top LazyGator Post subject: Re: Database Example question.Posted: Mon Mar 07, 2011 1:09 pm Joined: Mon Mar 15, 2010 2:35 pm Posts: 13 Location: Central Illinois Specifically, I was working with the validation code where the app checks to make sure all required data (i.e., customer first name) was entered. I did not receive an error when I failed to provide required data in a new customer record. Thanks. Top swort Post subject: Re: Database Example question.Posted: Mon Mar 07, 2011 1:38 pm Joined: Mon May 31, 2010 5:35 am Posts: 671 LazyGator wrote:Specifically, I was working with the validation code where the app checks to make sure all required data (i.e., customer first name) was entered. I did not receive an error when I failed to provide required data in a new customer record. Thanks. yes, you mean it accepts blanks? _________________ SWORTâ¢, it stands for Secure Web Object Realtime Transfer⢠- Windows Vista AND Linux Ubuntu 10.04 LTS - REAL Studio Enterprise(latest) and WEB Edition(latest) - REAL SQL Server 2009 Source of the Dutch User Groups Top LazyGator Post subject: Re: Database Example question.Posted: Mon Mar 07, 2011 1:42 pm Joined: Mon Mar 15, 2010 2:35 pm Posts: 13 Location: Central Illinois Correct. That was my experience. Top swort Post subject: Re: Database Example question.Posted: Mon Mar 07, 2011 2:25 pm Joined: Mon May 31, 2010 5:35 am Posts: 671 LazyGator wrote:Correct. That was my experience. well thats because there is no empty handling or as we call it, no validation. You could build it inside the example yourself to check.. as your working on. _________________ SWORTâ¢, it stands for Secure Web Object Realtime Transfer⢠- Windows Vista AND Linux Ubuntu 10.04 LTS - REAL Studio Enterprise(latest) and WEB Edition(latest) - REAL SQL Server 2009 Source of the Dutch User Groups Top LazyGator Post subject: Re: Database Example question.Posted: Mon Mar 07, 2011 2:50 pm Joined: Mon Mar 15, 2010 2:35 pm Posts: 13 Location: Central Illinois That is what I thought this code was supposed to do within this app (CheckMandatoryFields function call). Thanks. dim rec as DatabaseRecord dim rs as RecordSet // First we are going to verify that all of the required fields have data // in them. We do this by adding the required controls to an array and then // passing that to the CheckMandatoryFields function. See the comments in the // CheckMandatoryFields function for more information. dim Fields(-1) as RectControl dim Labels(-1) as String Fields.append CustomerFirst Fields.append CustomerLast Fields.append CustomerPhone Fields.append CustomerAddress Fields.append CustomerCity Fields.append CustomerState Fields.append CustomerPostalCode Labels = Array("First Name", "Last Name", "Phone Number", "Address", "City", "State/Region", "Postal Code") if not CheckMandatoryFields(Fields, Labels) then return// all required data has not been provided end Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 11 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]
