This topic is locked
[SOLVED]

 Insert data from a linked table

11/27/2012 1:31:14 PM
ASPRunnerPro General questions
author

Hello everyone,
I have a question on how to do a task. Mainly, is there a way to insert data from a different table in the list, view, add, edit, etc area.
Example: I have two database tables, "Main" and "MainSub" with a linked field between the two.
I create the ASPRunner list, view, add, edit, etc pages from the table "Main". In the generated pages, can I add another table structure (possible below the generated table) and fill it with the linked data from "MainSub"?
What I see in the Editor is the ability to add fields from the same table as the page was generated (Main). Is there a way to add fields from the second database table in the same page from database table "MainSub"?
How could I accomplish this please?
Your assistance is appreciated.

Joe

admin 11/27/2012

On 'SQL Query' screen in ASPRunnerPro you can add fields from other tables. Use 'Add table' button for this purpose to add the second table and choose one or more fields from joined tables.

G
gdmacdo 11/29/2012

Do you mean to have items "displayed" from the Main from in your MainSub? I often have the need to show/display Student information on a form using the StudentID # as the key field.
In this example, I create an ASP Code Snippet into my sub form. My Main table is called StuSchool and the student id number is in a field called ENRKSTDT. Since both my tables are linked to ENRKSTDT, it is my sub forms masterkey1. I use the example below to show the student's first name and last name which are stored in the StuSchool table.
Response.Write "Demographic Info Title for Display
"

if Session(strTableName & "_masterkey1")<>"" then

set rstmp = dal.Table("StuSchool").Query("ENRKSTDT=" & _

Session(strTableName & "_masterkey1"),"")

if not rstmp.eof then

Response.Write "First Name: " & rstmp("ENRFRST") & "
"

Response.Write "Last Name: " & rstmp("ENRLAST") & "
"

end if

rstmp.close

set rstmp=nothing

end if



Hello everyone,
I have a question on how to do a task. Mainly, is there a way to insert data from a different table in the list, view, add, edit, etc area.
Example: I have two database tables, "Main" and "MainSub" with a linked field between the two.
I create the ASPRunner list, view, add, edit, etc pages from the table "Main". In the generated pages, can I add another table structure (possible below the generated table) and fill it with the linked data from "MainSub"?
What I see in the Editor is the ability to add fields from the same table as the page was generated (Main). Is there a way to add fields from the second database table in the same page from database table "MainSub"?
How could I accomplish this please?
Your assistance is appreciated.

Joe

1312 11/30/2012

Thank you both for the response.
Sergey did answer my question and it works wonderfully. Greg Mac you did enlighten me on yet another way to meet my goal of displaying information from two tables in the same page.
Thank you both the information really gave me direction to meet my needs.

Joe