Solved

Simple ASP VBscript Question

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

895 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

18 Experts available now in Live!

Get 1:1 Help Now