I got these 3 tables
Ques Table
Ques |Ans |QuesID|LangID
__________________________________________
Ques1|Ques1's Answer|1 |1
Ques2|Ques2's Answer|2 |2
LangID is a Foreign Key that References LangID in table Languages
Languages Table
LangID |Description|LanguageID
______________________________________
1 |French |1
2 |English |2
Language Table is for website’s contents’ language
EditorLanguage table
LanguageID|Value|Desc
______________________
1 |fr-FR|French
2 |en-US|English US
EditorLanguage Table is for RadEditor’s Language
When a new Ques is added:-
The InsertUpdateQues Stored Procedure inserts the following values in Ques Table:-
QuesID, Ques, Ans, LangID
Now on my Ques Page, I have the following:-
-A drop down list box to select language (this drop down is bound to EditorLanguage Table's Desc column)
-A Text Box for Ques
-Telerik RadEditor for Ques's Answer
- Submit cancel buttons
Now lets say the langauage selected from the drop down is French whose language ID=1, Value=fr-FR, desc=French
Now how do I pass this LangID value to InsertUpdateQues Stored proceedure. I mean how it should get this value?
I am confused because of this Foreign Key thing..new too ms sql
How will the logic be formed? What is even going on here ?
so ok it will get LangID somehow but how and what good will that do ? I am suddenly feeling lost.
Why are
LanguagesandEditorLanguageseparate tables? Based on what you’re showing us, it looks like they would be better as a single table. The table names and key names are unintuitive as well.As it stands right now, you’re going to have to translate the
LanguageIDthat the form is posting into aLangIDthat theQuestable needs. This can be done in code by hitting the database (or a cached lookup) to selectLangIDfromLanguageswhereLanguageIDequals the value you have. Or you can do this inside of the stored procedure you’re calling (so it’s only a single trip to the database) by either selecting the value into a variable and using the variable in your insert/update, or by using a subquery in your insert/update to select the value.Note that this may get clouded if there’s any kind of one-to-many relationship between
LanguagesandEditorLanguage.