Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How do I pass a variable to a SQL statement in FP

Posted on 2003-10-28
4
Medium Priority
?
290 Views
Last Modified: 2013-12-24
I have a form that list multiple divisions in a drop down list. I want to be able to assign the department to the division without having to ask the user to select the department.

My SQL statement might look something like

Select Lname, Fname, SSN From Personnel Where Division='::Division::' and Dept='::varDept::'

I will use VBScript to create the varDept entry but I cannot figure out how to pass the variable to the sql statement. Any ideas?
0
Comment
Question by:rcmb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 14

Expert Comment

by:hhammash
ID: 9639784
Hi,

You will have to use the dynamic array.  The array should be multi-dimensional.  The list box will display the divisin,  then when the user makes the selection,  the department field will be automatically filled with the second dimension of the array which has the department name.

regards
hhammash

0
 
LVL 14

Expert Comment

by:hhammash
ID: 9639995
Hi,
Plese check this link:
http://www.fmhs.uaeu.ac.ae/nml/900test.asp

If this is what you need,  there is a very easy way to do it in Frontpage:

This is the way.
------------------
The page names here are only for my example, you can change them:

01- Create a new page and save it as SubmitInfo.asp
02- Insert a form
03- Remove the buttons of the form
04- Inside the form insert a DRW
05- Pick up only the Division field
06- Make the DRW drop down menu (Option 4/5)
07- Then proceed and finish the DRW
08- Right click the form select properties and name the form as MyForm
09- Post the form to SubmitInfo.asp
10- Go back to the page, click once on the Drop down
11- Switch to HTML view
12- Add onChange=Myform.submit() to the drop down code
It should look like:
<select NAME="CustomerID" SIZE="1" onChange=MyForm.submit()>
13- Go back to the page,  save it
14- Under the first form insert a new form,  keep the buttons
15- In the second form insert another DRW
16- Make the DRW to pick up only Department Field
17- In the criteria select DivisionName=DivisionName
18- In the default value put a division number to keep the DRW, otherwise you will have  "no records returned".
19- Continue with the DRW and make it list-one field per item
20- In the list options select TextFields
21- Continue the DRW, and uncheck the Add Search form checkbox
22- Finish the DRW
23- Go to the page and remove the buttons of the DRW
24- Save the page
25- Post the second form which has the second DRW to the Database
26- Save the page

Hope it helps
hhammash
0
 
LVL 12

Author Comment

by:rcmb
ID: 9668058
hhammash

What you posted helps the example I provided but did not answer the question. I am trying to pass a variable to a sql statement. I can do it if I just use straight ASP but what I am trying to do is get a vaiable accepted by the SQL code in FrontPage. Any ideas?

RCMB
0
 
LVL 14

Accepted Solution

by:
hhammash earned 750 total points
ID: 9669258
Hi,

I hope I understood what you meant.  Please try the above link again,  select a customerid, the country will be selected and press submit.

If this is what you need.  You have to follow my steps above but:

After step 16 and before 17,  lets say 16a:
1- Right Click the form
2- Select form properties
3- Click advanced
4- Click Add
5- Type the field name exactly,  in my case it is CustomerID
6- In the value type <%=request.form("CustomerID")%>

Modify Step 17 and select Division=Division and Dept=Dept

Your sql should look like:
Select Lname, Fname, SSN From Personnel Where(Division='::Division::' and Dept='::varDept::')

varDept should be the field in the form hidden field.

Then post the form to the page that has the SQL,  which is waiting to the variables passed from the form.  If the SQL is on the same page then post the form to the page itself.

Regards
hhammash

0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this short web based tutorial, I wanted to show users how they can still use the powers of FrontPage in conjunction with Expression Web 3.  Even though Microsoft eliminated the use of Web components, we can still use them with FrontPage and edit …
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
The purpose of this video is to demonstrate how to automatically show related posts at the bottom of a blog post in WordPress. This will be demonstrated using a Windows 8 PC. Plugin “Yet Another Related Posts Plugin” will be used. Go to your…
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question