|
 |
asp_web_howto thread: Question: Using variable as condition to update via SP
Message #1 by msavoy@h... on Wed, 12 Jun 2002 19:56:02
|
|
My initial problem is that I cannot see the value of the "strregtype" in
order to meet the condition whereby I am trying to write the boolean
value to the SQL table. What am I doing wrong? Here is the code. Any
help is appreciated. Thanks in advance.
I have a query that I have in my code where I have assigned a variable to
one of the fields:
'***** Code to pull the registration info from the SQL table. *****
strSQLStatement = "SELECT * " & _
"FROM cguser_registration_info " & _
"WHERE id = '" & value & "' "
Set rs = objUser.getRecordset(strSQLStatement)
If Not rs.EOF Then
strpracticename = trim(rs("practice_name"))
straltpracticename = trim(rs("alt_practice_name"))
strlastname = trim(rs("last_name"))
strfirstname = trim(rs("first_name"))
strmi = trim(rs("m_name"))
strtitle = trim(rs("title"))
straddress1 = trim(rs("address_1"))
straddress2 = trim(rs("address_2"))
strstate = trim(rs("state"))
strregtype = trim(rs("registration_type"))
End If
rs.Close
I am using the following code to update a SQL table:
If Request.ServerVariables("REQUEST_METHOD") = "POST" And LCase
(request.form("submit")) = "add to helpdesk" Then
'***** Setup the command object to run the stored procedure. *****
Set cmdADOCommand = Server.CreateObject("ADODB.Command")
Set prmADOParameter = Server.CreateObject("ADODB.Command")
Set cmdADOCommand.ActiveConnection = HD_CGuser
cmdADOCommand.CommandType = adCmdStoredProc
'***** Run the Insert_Customer stored procedure. *****
strParmName = "OrgID"
Set prmADOParameter = cmdADOCommand.CreateParameter(strParmName,
adInteger, adParamInput)
cmdADOCommand.Parameters.Append prmADOParameter
If Request.Form("organization") <> "" Then
cmdADOCommand.Parameters(strParmName).Value = CInt(Request.Form
("organization"))
Elseif Request.Form("organization2") <> "" Then
cmdADOCommand.Parameters(strParmName).Value = CInt(Request.Form
("organization2"))
Elseif Request.Form("organization3") <> "" Then
cmdADOCommand.Parameters(strParmName).Value = CInt(Request.Form
("organization3"))
End If
strParmName = "Address_1"
Set prmADOParameter = cmdADOCommand.CreateParameter(strParmName,
adVarChar, adParamInput, 50)
cmdADOCommand.Parameters.Append prmADOParameter
cmdADOCommand.Parameters(strParmName).Value = trim(Request.Form
("address1"))
strParmName = "Address_2"
Set prmADOParameter = cmdADOCommand.CreateParameter(strParmName,
adVarChar, adParamInput, 50)
cmdADOCommand.Parameters.Append prmADOParameter
cmdADOCommand.Parameters(strParmName).Value = trim(Request.Form
("address2"))
strParmName = "CityID"
Set prmADOParameter = cmdADOCommand.CreateParameter(strParmName,
adInteger, adParamInput)
cmdADOCommand.Parameters.Append prmADOParameter
cmdADOCommand.Parameters(strParmName).Value = CInt(Request.Form
("city"))
strParmName = "State"
Set prmADOParameter = cmdADOCommand.CreateParameter(strParmName,
adVarChar, adParamInput, 2)
cmdADOCommand.Parameters.Append prmADOParameter
cmdADOCommand.Parameters(strParmName).Value = trim(Request.Form
("state"))
strParmName = "ZipCode"
Set prmADOParameter = cmdADOCommand.CreateParameter(strParmName,
adVarChar, adParamInput, 10)
cmdADOCommand.Parameters.Append prmADOParameter
cmdADOCommand.Parameters(strParmName).Value = trim(Request.Form
("zipcode"))
strParmName = "IsPhysician"
Set prmADOParameter = cmdADOCommand.CreateParameter(strParmName,
adBoolean, adParamInput)
cmdADOCommand.Parameters.Append prmADOParameter
If strregtype = "Physician" Then
cmdADOCommand.Parameters(strParmName).Value = 1
Else
cmdADOCommand.Parameters(strParmName).Value = 0
End If
strSQLStatement = "PSS_Customer_Services.dbo.Insert_Customer"
cmdADOCommand.CommandText = strSQLStatement
cmdADOCommand.Execute
|
|
 |