Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Simple ASP VBscript Question

Posted on 1997-11-17
2
Medium Priority
?
171 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 200 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

715 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