Solved

Simple ASP VBscript Question

Posted on 1997-11-17
2
166 Views
Last Modified: 2013-12-25
I have a form, RBS.htm, from which I get a 5-digit input, 'WebPersonalID', from the user. Upon clicking a submit button, it loads 'BookingsQuery.asp'. I want to know how to reference 'WebPersonalID' in this ASP file, and then use it as part of a query to a database.

This is what I have tried so far, but it keeps returning a 'Data Type Mismatch' error.
------------------------------------
<%
    WebID = Request.Form("WebPersonalID")
%>  
<%  sql = "SELECT DISTINCTROW Accounts.PersonalID, Accounts.FirstName, Accounts.Surname, Accounts.BusinessTel, Accounts.CellularTel, Accounts.EmailAddress, Schedule.Date, Schedule.PeriodBooked, Schedule.ObjectBooked  FROM Accounts LEFT JOIN Schedule ON Accounts.PersonalID = Schedule.PersonalID  WHERE (Schedule.PersonalID)='%%WebID%%'"
--------------------------------------------
What am I doing wrong and how can I correct it?

Thank you.
0
Comment
Question by:cress
2 Comments
 
LVL 1

Accepted Solution

by:
Rusken earned 50 total points
ID: 1855579
You will need something like this:

<% WebID = Request("WebPersonalID")
%>
<% sql = "SELECT DISTINCTROW Accounts.PersonalID, Accounts.FirstName, Accounts.Surname, Accounts.BusinessTel, Accounts.CellularTel, Accounts.EmailAddress, Schedule.Date, Schedule.PeriodBooked, Schedule.ObjectBooked FROM Accounts LEFT JOIN Schedule ON Accounts.PersonalID = Schedule.PersonalID WHERE (Schedule.PersonalID)='" &  WebId & "'"
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open session("ConnectionString")
Set RS = Conn.Execute(Sql)


This code suggests that WebID is a text field. If this is not correct you will have to omit the '  ' charcters.
Hope this helps, if not, please  give me a note.
0
 

Author Comment

by:cress
ID: 1855580
That's great, Rusken. Thanks. Works fine now.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Why accessing this airline website ends up with access denied? 19 85
modify h2 4 115
Handling onsession end function in Application.cfc 5 54
Adwords and keywords 2 36
"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…

776 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