Solved

Simple ASP VBscript Question

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

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

14 Experts available now in Live!

Get 1:1 Help Now