PS. Please post only the relevant portion of the code. We don't need to
see the entire page, html and all. Just the snippet where you set the
parameter values and execute the stored procedure.
Hi
Here is the relevant code from the page:
<%
set rsCountry = Server.CreateObject("ADODB.Recordset")
rsCountry.ActiveConnection = MM_connrails_STRING
rsCountry.Source = "SELECT CountryName FROM dbo.tblcountry ORDER BY
CountryName ASC"
rsCountry.CursorType = 0
rsCountry.CursorLocation = 2
rsCountry.LockType = 3
rsCountry.Open()
rsCountry_numRows = 0
%>
<%
Dim Command1__title
Command1__title = ""
if(Request("title") <> "") then Command1__title = Request("title")
Dim Command1__fname
Command1__fname = ""
if(Request.Form("FirstName") <> "") then Command1__fname =
Request.Form("FirstName")
Dim Command1__lname
Command1__lname = ""
if(Request.Form("LastName") <> "") then Command1__lname =
Request.Form("LastName")
Dim Command1__cemail
Command1__cemail = ""
if(Request.Form("CustomerEmail") <> "") then Command1__cemail =
Request.Form("CustomerEmail")
Dim Command1__billadd1
Command1__billadd1 = ""
if(Request.Form("BillingAddress1") <> "") then Command1__billadd1 =
Request.Form("BillingAddress1")
Dim Command1__billadd2
Command1__billadd2 = ""
if(Request.Form("BillingAddress2") <> "") then Command1__billadd2 =
Request.Form("BillingAddress2")
Dim Command1__billcity
Command1__billcity = ""
if(Request.Form("BillingCity") <> "") then Command1__billcity =
Request.Form("BillingCity")
Dim Command1__billregion
Command1__billregion = ""
if(Request.Form("BillingState") <> "") then Command1__billregion =
Request.Form("BillingState")
Dim Command1__billpostcode
Command1__billpostcode = ""
if(Request.Form("BillingPostalcode") <> "") then Command1__billpostcode =
Request.Form("BillingPostalcode")
Dim Command1__billcountry
Command1__billcountry = ""
if(Request.Form("BillingCountryID") <> "") then Command1__billcountry =
Request.Form("BillingCountryID")
Dim Command1__phone
Command1__phone = ""
if(Request.Form("Phone") <> "") then Command1__phone = Request.Form("Phone")
Dim Command1__deladd1
Command1__deladd1 = ""
if(Request.Form("DeliveryAddress1") <> "") then Command1__deladd1 =
Request.Form("DeliveryAddress1")
Dim Command1__deladd2
Command1__deladd2 = ""
if(Request.Form("DeliveryAddress2") <> "") then Command1__deladd2 =
Request.Form("DeliveryAddress2")
Dim Command1__scity
Command1__scity = ""
if(Request.Form("DeliveryCity") <> "") then Command1__scity =
Request.Form("DeliveryCity")
Dim Command1__sregion
Command1__sregion = ""
if(Request.Form("deliverystate") <> "") then Command1__sregion =
Request.Form("deliverystate")
Dim Command1__spostcode
Command1__spostcode = ""
if(Request.Form("DeliveryPostalcode") <> "") then Command1__spostcode =
Request.Form("DeliveryPostalcode")
Dim Command1__shipcountry
Command1__shipcountry = ""
if(Request.Form("DeliveryCountryID") <> "") then Command1__shipcountry =
Request.Form("DeliveryCountryID")
Dim Command1__special
Command1__special = ""
if(Request.Form("SpecialInstructions") <> "") then Command1__special =
Request.Form("SpecialInstructions")
%>
<%
' *** Edit Operations: declare variables
MM_editAction = CStr(Request("URL"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Request.QueryString
End If
' boolean to abort record edit
MM_abortEdit = false
' query string to execute
MM_editQuery = ""
%>
<%
If (Request.Form("flag") = "add")Then
set Command1 = Server.CreateObject("ADODB.Command")
Command1.ActiveConnection = MM_connrails_STRING
Command1.CommandText = "dbo.spcheckout1"
Command1.Parameters.Append Command1.CreateParameter("@title", 200,
1,50,Command1__title)
Command1.Parameters.Append Command1.CreateParameter("@fname", 200,
1,50,Command1__fname)
Command1.Parameters.Append Command1.CreateParameter("@lname", 200,
1,50,Command1__lname)
Command1.Parameters.Append Command1.CreateParameter("@cemail", 200,
1,50,Command1__cemail)
Command1.Parameters.Append Command1.CreateParameter("@billadd1", 200,
1,50,Command1__billadd1)
Command1.Parameters.Append Command1.CreateParameter("@billadd2", 200,
1,50,Command1__billadd2)
Command1.Parameters.Append Command1.CreateParameter("@billcity", 200,
1,50,Command1__billcity)
Command1.Parameters.Append Command1.CreateParameter("@billregion", 200,
1,50,Command1__billregion)
Command1.Parameters.Append Command1.CreateParameter("@billpostcode", 200,
1,50,Command1__billpostcode)
Command1.Parameters.Append Command1.CreateParameter("@billcountry", 200,
1,50,Command1__billcountry)
Command1.Parameters.Append Command1.CreateParameter("@phone", 200,
1,50,Command1__phone)
Command1.Parameters.Append Command1.CreateParameter("@deladd1", 200,
1,50,Command1__deladd1)
Command1.Parameters.Append Command1.CreateParameter("@deladd2", 200,
1,50,Command1__deladd2)
Command1.Parameters.Append Command1.CreateParameter("@scity", 200,
1,50,Command1__scity)
Command1.Parameters.Append Command1.CreateParameter("@sregion", 200,
1,50,Command1__sregion)
Command1.Parameters.Append Command1.CreateParameter("@spostcode", 200,
1,50,Command1__spostcode)
Command1.Parameters.Append Command1.CreateParameter("@shipcountry", 200,
1,50,Command1__shipcountry)
Command1.Parameters.Append Command1.CreateParameter("@special", 200,
1,200,Command1__special)
Command1.Parameters.Append Command1.CreateParameter("@Ident", 3, 4)
Command1.CommandType = 4
Command1.CommandTimeout = 0
Command1.Prepared = true
Command1.Execute()
LastIdent = Command1.Parameters("@Ident")
Session("customerid")=LastIdent
Response.Redirect "/shop/checkout2.asp"
End if
%>
<html>
Here is the Stored Procedure:
if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[spcheckout1]') and OBJECTPROPERTY(id, N'IsProcedure') =
1)
drop procedure [dbo].[spcheckout1]
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE [dbo].[spcheckout1]
@title nvarchar(50),
@fname nvarchar(50),
@lname nvarchar(50),
@cemail nvarchar(50),
@billadd1 nvarchar(50),
@billadd2 nvarchar(50),
@billcity nvarchar(50),
@billregion nvarchar(50),
@billpostcode nvarchar(50),
@billcountry nvarchar(50),
@phone nvarchar(50),
@deladd1 nvarchar(50),
@deladd2 nvarchar(50),
@scity nvarchar(50),
@sregion nvarchar(50),
@spostcode nvarchar(50),
@shipcountry nvarchar(50),
@special nvarchar(200),
@Ident int OUTPUT
AS
SET NOCOUNT ON
insert into dbo.tblCustomer
(Title,FirstName,LastName,CustomerEmail,BillingAdd ress1,BillingAddress2,
BillingCity,BillingRegion,BillingPostalCode,Billin gCountry,Phone,DeliveryAdd
ress1,DeliveryAddress2,
DeliveryCity,DeliveryRegion,DeliveryPostalCode,Del iveryCountry,SpecialInstru
ctions) values
(@title,@fname,@lname,@cemail,@billadd1,@billadd2, @billcity,@billregion,@bil
lpostcode,
@billcountry,@phone,@deladd1,@deladd2,@scity,@sreg ion,@spostcode,@shipcountr
y,@special)
SET NOCOUNT OFF
SELECT @Ident = @@IDENTITY
RETURN @Ident
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
Cheers
Richard