Solved

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

Posted on 2003-10-28
4
276 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
  • 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 250 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

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 …
Introduction In this tutorial, I'll explain how to create an animated progress meter in a wireframe prototype developed using Axure RP 7.0 - a leading prototyping tool for designing web sites and software. (For more information about Axure and gett…
The purpose of this video is to demonstrate how to make a WordPress Site faster and smaller in size by cleaning up the database. This will be demonstrated using a Windows 8 PC. Plugin WP Optimize will be used. Go to your WordPress login page. T…
The purpose of this video is to demonstrate how to insert an Iframe into WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Open Page or Post…

707 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now