New topic: Database Question
<http://forums.realsoftware.com/viewtopic.php?t=38829> Page 1 of 1 [ 4 posts ] Previous topic | Next topic Author Message S.Rampling Post subject: Database QuestionPosted: Fri Apr 29, 2011 9:30 pm Joined: Sat Jan 08, 2011 4:47 pm Posts: 272 Location: Sydney, Australia I will try and explain what I would like to do..You have a Track and for each track you can have multiple entries. Track1 date class time etc date class time etc date class time etc Track2 date class time etc date class time etc date class time etc Each Track can have from 1 to whatever entries (probably a maximum of 20) The DB code I have is Code:karter.SQLExecute"CREATE TABLE gearing (pk INTEGER PRIMARY KEY NOT NULL , track text, length text, class text, gearing text, laptime text, mybest text)" And the code I am using to display it is Code: dim rs as recordset = karter.SQLSelect("select * from gearing where PK = "+ str(gearingpk)) while not rs.eof lstdriver.AddRow(rs.Field("track").StringValue) lstdriver.cell(lstdriver.LastIndex, 1) = rs.Field("length").StringValue lstdriver.cell(lstdriver.LastIndex, 2) = rs.Field("class").StringValue lstdriver.cell(lstdriver.LastIndex, 3) = rs.Field("gearing").StringValue lstdriver.cell(lstdriver.LastIndex, 4) = rs.Field("laptime").StringValue lstdriver.cell(lstdriver.LastIndex, 5) = rs.Field("mybest").StringValue rs.MoveNext wend rs.Close The display code works fine with dummy data added to the database. What I don't understand how to do is save or display the multiple entries under the one track(heading) Thanks Shane _________________ Thanks to any and all who can help with my limited knowledge of Real Studio. 54YO Kart Racer from Sydney Australia Real Studio 2010r5.1 Win 7 Top timhare Post subject: Re: Database QuestionPosted: Fri Apr 29, 2011 10:27 pm Joined: Fri Jan 06, 2006 3:21 pm Posts: 9761 Location: Portland, OR USA Create a table with columns: pk TrackPK Date Class Time I would display these records in a separate list. When the user selects a track, display the extra records for that track. Top S.Rampling Post subject: Re: Database QuestionPosted: Fri Apr 29, 2011 10:36 pm Joined: Sat Jan 08, 2011 4:47 pm Posts: 272 Location: Sydney, Australia Hi Tim, not quite sure what you mean or how to go about it. _________________ Thanks to any and all who can help with my limited knowledge of Real Studio. 54YO Kart Racer from Sydney Australia Real Studio 2010r5.1 Win 7 Top BrianOBrien Post subject: Re: Database QuestionPosted: Fri Apr 29, 2011 11:16 pm Joined: Wed Jul 07, 2010 2:55 pm Posts: 306 Location: University Of Calgary, Faculty Of Medicine Is it possible you are asking how to make two tables from one, where one table has a foreign key to the other? _________________ If at first you don't succeed... Try REALBasic. Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 4 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]
