?
Solved

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

Posted on 2003-10-28
4
Medium Priority
?
289 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

WordPress Tutorial 3: Plugins, Themes, and Widgets

The three most common changes you will make to your website involve the look (themes), the functionality (plugins), and modular elements (widgets).

In this article we will briefly define each again, and give you directions on how to install them.

Question has a verified solution.

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

When deciding to adopt any help desk solutions many factors should be explored before taking decisions. This will change from business to another but in general there are some kind of rule of thumb. Here are some quick tips: Do we need only ticket…
Now that Expression Web 4.0 (http://www.microsoft.com/expression/products/Upgrade.aspx) is free if you buy or have the full version of Expression Web 3.0, now is the best time to  migrate from FrontPage to Expression Web (http://www.frontpage-to-exp…
The purpose of this video is to demonstrate how to integrate Mailchimp with Facebook. This will be demonstrated using a Windows 8 PC. Mailchimp and Facebook will be used. Log into your Mailchimp account. : Click on your name. Go to Account Setti…
The purpose of this video is to demonstrate how to prevent comment spam on a WordPress Website. This will be demonstrated using a Windows 8 PC. Plugin Akismet will be used. Go to your WordPress login page. This will look like the following: myw…
Suggested Courses

762 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