-
Tornado - Populating a Dropdown from another SQL Database
Using Tornado, how can a dropdown(selectbox) be populated from another database (one outside the SQL statement)?
An example of this syntax, on your WEB site, would be helpful.
-
you must mean val / tex index of the edit fields - correct ?
questions -
* static or dynamic data for dropdown?
* Same source different table or different source ?
FK
-
Tornado - Populating a Dropdown from another SQL Database
OK, I want to use a database table from a different source which contains information needed to populate a dropdown box. How do I do this? Again, an example on the WEB site would be helpful....
-
data is static or dynamic ?
FK
-
The data exists in a table. We need to read a field of data from that table which exists in a different source. How else can I say this?
I'm unsure how you define static and dynamic as it relates to a tables data.
But, whatever the type it needs to be used to populate a dropdown so a user can select it.
-
Let's say your drop data comes from MS-SQL Northwind and you are using it in ACCESS NWIND.
Module #1 - (MS-SQL)
Use dbCommonTables to define the drop indexes. Make this module run only one time dbFirstTimeOnly=true, invisible etc.... These indexes are COMMON and available throughout the entire session.
Module #2 - (ACCESS)
build your tex/val drops using the indexes by name and go on with your work. Unlike ASP, Tornado dropdwons and lookup is designed to handle a case like this one.
-
dynamic means the drop data can change every time (rare) - scratch this case...
static is fine. See previous message.
FK
-
Thanks for the information but it still doesn't explain how I declare a SQL statement to use a different DSN source in .dbcommontables. Here's my code
Dim cTbls as String = ""
cTbls = "index=Anamex|sql=SELECT FullName FROM PersInfo;"
cTbls = cTbls & "index=Classx|sql=SELECT Schedule FROM DatesTimes"
.dbCommonTables=cTbls
explanation of code: PersInfo is in a different DSN then DatesTimes. I need to get data from PersInfo to populate a dropdown then save the resulting selection to DatesTimes, a table the main proram DSN.
-
>>..PersInfo is in a different DSN then DatesTimes
You mean differnt DSN or same DSN but different TABLEs?
If same DB and different tables (normal case) then use a JOIN to build the SQL and then build the Index using index=Anamex,Classx|SQL=SELECT Anamex,Classx from (JOIN TABLE)
If different DSN (unusual) then use two modules to produce each index
Anamex
Classx
FK
-
try the following and see how to draw the drop data from different tables -
<script language='vb' runat='server'>
Sub Page_Load(Source as Object, E as EventArgs)
Dim Update As New Tornado.Z()
'...DropDown
With Update
.dbQP="U=5|S=3|D=Nwind.Mdb|Q=Select * From employees|gdf=0,1|ni=b5,update|bm=employees;0|Th=T itle=Update DropDown"
.dbMode = "ty=dual-horiz| sysind=t"
.dbEditUpdateFlds = "fi=0|ty=RONOUPdate,4,fi=HireDate|ty=TextCalendar, fi=HomePhone|ty=TEXT,fi=ReportsTo|ty=SELECTBOX|val =EID|tex=FullName,fi=Notes|type=TextArea|tag=COLS= 25 ROWS=5"
'...you can skip Val (=Tex) but you cannot skip Tex
.dbCommonTables = "index=First,FullName|sql=Select Firstname,Firstname & ' ' & Lastname from employees; index=EID|sql=Select Employeeid from employees"
.dbLookUpFlds = "fi=EmployeeID|key=EID|look=FullName,fi=ReportsTo| key=EID|look=Fullname"
.ASPdbNET()
End With
'...Dropdown is for edit and filter only. It forces user to pick the pre-determined values. dbCommonTables is used the same way as lookup. The (ReportsTo) field is defined as a SelectBox and the dropdowns VALUE and corresponding TEXT are selected from the commontables
End Sub
</script>
-
Thanks for the code and explanation.
However, I need an example containing a dropdown which is populated from a table using a different DSN. The one you have here doesn't appear to satisfy that criteria. I was able to do this using ASPdb Classic Gold with no problems.
-
The code for supporting different DSN, and provider(DotNet) in Commontables exists but not opened due to the potential problems of uneven lists treatment. But then I was reminded that manual lists already have that problem. SO, let me do some testing and if there is no ill effect, then I'll open that. Property looks something like -> index=Aname| SQL=Statement~DSN~Provider.
FK
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|