Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 8th, 2005, 12:03 AM
Registered User
 
Join Date: Mar 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default SQL query using a session variable

Hi guys,

This is my query.

I have a login page (login.asp) which uses standard Dreamweaver MX 2004 login feature. The username gets stored in a session variable MM_Username

THis session variable gets carried forward to a basic list page which has hyperlinks to get more detail. I can see the session variable in this 3rd page - detaillist.asp.

On the detaillist.asp page I want to now get the userid based on the username stored in the MM_Username variable.

Code is:

<%
Dim UserID

Set UserID = Server.CreateObject("ADODB.Recordset")
UserID.ActiveConnection = MM_LocalSQL_STRING
UserID.Source = "SELECT lgClients.ID FROM dbo.lgClients WHERE dbo.lgClients.Username = " + Replace (Detail_query__MMUsername, "'", "''") + " "
UserID.CursorType = 0
UserID.CursorLocation = 2
UserID.LockType = 1
UserID.Open()

%>

It throws a Microsoft VB Script compilation (0x800A03EA) Syntax error
Its the + Replace bit thats sick...








Similar Threads
Thread Thread Starter Forum Replies Last Post
session and variable... badboy1 ASP.NET 3.5 Basics 1 August 3rd, 2008 09:14 AM
Query Result to Session Variable johnp ASP.NET 2.0 Basics 1 April 6th, 2006 11:15 PM
Sql Query With Variable jittendersaini Beginning PHP 1 April 4th, 2006 07:33 AM
Session variable anuradha80 General .NET 3 November 4th, 2004 12:39 AM
Setting a Variable = Result of a SQL Query PeteS VB Databases Basics 1 June 20th, 2003 08:14 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.