Database with two tables
Posted: Sun Feb 14, 2021 7:31 am
Hello everyone,
I created a databases (sqlite) with two tables (this is my first time to do this I used in one table). I already linked them but i'm having a problem in my combo box and in my section field. I want in my combobox to display the list of the section name(not secID) here is my code below. Thanks in advance everyone
This code below will get the section ID based on the combobox selected by the user.
![Image]()
I created a databases (sqlite) with two tables (this is my first time to do this I used in one table). I already linked them but i'm having a problem in my combo box and in my section field. I want in my combobox to display the list of the section name(not secID) here is my code below. Thanks in advance everyone
Code: Select all
command Sections
local tlist
put AllMyLearnersList() into tlist
set the text of btn "SectionList" to tlist
end Sections
function AllMyLearnersList
global gDatabaseID,
local tSQLStatement, tlist
// i tried to changed it into SecName it will display the list of sectionName but there will no link in two tables.
put "SELECT SecID FROM Sections "into tSQLStatement
put revDataFromQuery(tab,return,gDatabaseID,tSQLStatement) into tlist
return tlist
end AllMyLearnersList
This code below will get the section ID based on the combobox selected by the user.
Code: Select all
command GetStudentInfo
local tLRN, tStudentName, tSectionName,tSectionID_FK
local tStudentID
put fld "LRNFld" into tLRN
put fld "StudentNameFld" into tStudentName
put the label of btn "SectionList" into tSectionName
// this is the part where i will get the sectionID from the combobox
put the label of btn "SectionList" into tSectionID_FK
put fld "StudentIDFld" into tStudentID
if tStudentID is empty then
SaveSaveInfo tSectionID_FK,tLRN,tStudentName,tSectionName
end if
end GetStudentInfo