Solved

Simple ASP VBscript Question

Posted on 1997-11-17
2
170 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
[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
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

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

729 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