Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command (Stored Procedure) not accepting variables

Status
Not open for further replies.

sbbrown9924

Technical User
Mar 7, 2003
80
US
Resources:

Windows XP/IIS 5.0/Access/vbscript/asp/Dreamweaver MX2004.

I am using a command (stored procedure) within an asp page so that I can write to multiple databases (there is another INSERT INTO in the same page). The command looks like this:

<%

if(Request.Form("FirstName") <> "") then Command1__strFirstName = Request.Form("FirstName")

%>
<%

set Command1 = Server.CreateObject("ADODB.Command")
Command1.ActiveConnection = MM_HCAP_STRING
Command1.CommandText = "INSERT INTO HCAP (FirstName,Status) VALUES ('" + Replace(Command1__strFirstName, "'", "''") + "','NOT SEEN') "
Command1.CommandType = 1
Command1.CommandTimeout = 0
Command1.Prepared = true
Command1.Execute()

%>

I've also handwritten this with the same result:

Insert into HCAP (FirstName,Status) Values('Request.Form("FirstName"),'NOT SEEN')

The result is that the literal "NOT SEEN" gets written to a new record in the HCAP database but the form data in field FirstName (this is both form field name and hcap table field name) does not. I am having no problem writing literals, its just the form data. Any suggestions?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top