473,396 Members | 1,963 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

stored procedure and asp problems

Hi-
I'm having problems with the following stored procedure. Below
first I have the stored proc, then I have the asp code that calls it.
Randomly it won't insert the order into the database and a way out of
sequence order id is returned. My connection string looks like this:

Provider=SQLOLEDB;Data Source=192.168.1.2;Initial
Catalog=myDatabase;Network Library=DBMSSOCN;Persist Security
Info=True;User Id=myUser;Password=myPassword

The web server and the sql server are directly connected using a
crossover cable. Now for the sproc:

CREATE PROCEDURE myUser.sp_orderInital
@iCustID VarChar(40),
@iPayID VarChar(40),
@iAddrID VarChar(40),
@orderAmount VarChar(25),
@orderComments NText,
@orderSTax VarChar(25),
@orderShipMethod VarChar(200),
@orderShippingAmount VarChar(25),
@orderBrowser VarChar(250),
@orderGrandTotal VarChar(25),
@orderPaymentMethod VarChar(100),
@orderCheckAcctNumber VarChar(100),
@orderCheckNumber VarChar(100),
@orderBankName VarChar(250),
@orderRoutingNumber VarChar(100),
@orderPurchaseOrderName VarChar(250),
@orderPurchaseOrderNumber VarChar(100),
@orderRemoteAddress VarChar(30),
@orderTradingPartner VarChar(250),
@orderHttpReferrer VarChar(250)
AS
DECLARE @orderID INT

INSERT INTO sfOrders (orderCustId, orderPayId, orderAddrId,
orderAmount, orderComments, orderSTax, orderShipMethod,
orderShippingAmount, orderGrandTotal, orderPaymentMethod,
orderCheckAcctNumber, orderCheckNumber, orderBankName,
orderRoutingNumber, orderPurchaseOrderName,
orderPurchaseOrderNumber,
orderRemoteAddress, orderHttpReferrer, orderTradingPartner,
orderBrowser)
VALUES (@iCustID, @iPayID, @iAddrID,
@orderAmount, @orderComments, @orderSTax, @orderShipMethod,
@orderShippingAmount, @orderGrandTotal, @orderPaymentMethod,
@orderCheckAcctNumber, @orderCheckNumber, @orderBankName,
@orderRoutingNumber, @orderPurchaseOrderName,
@orderPurchaseOrderNumber,
@orderRemoteAddress, @orderHttpReferrer, @orderTradingPartner,
@orderBrowser)

SELECT @orderID = @@IDENTITY
RETURN @orderID
GO

************************************************** ******
Now the asp code starts
************************************************** ******

Dim iOrderID

Dim cmdOrders
Set cmdOrders = Server.CreateObject("ADODB.Command")

With cmdOrders
.ActiveConnection = cnn
.CommandText = "bradley.sp_OrderInital"
.CommandType = adCmdStoredProc
'sdfsdfsdff;sdfsd;
.Parameters.Append .CreateParameter ("RetVal", adVarWChar,
adParamReturnValue, 40)
.Parameters.Append .CreateParameter ("@iCustID", adVarWChar,
adParamInput, 40)
.Parameters.Append .CreateParameter ("@iPayID", adVarWChar,
adParamInput, 40)
.Parameters.Append .CreateParameter ("@iAddrID", adVarWChar,
adParamInput, 40)
.Parameters.Append .CreateParameter ("@orderAmount", adVarWChar,
adParamInput, 25)
.Parameters.Append .CreateParameter ("@orderComments",
adLongVarWChar, adParamInput, 4000)
.Parameters.Append .CreateParameter ("@orderSTax", adVarWChar,
adParamInput, 25)
.Parameters.Append .CreateParameter ("@orderShipMethod", adVarWChar,
adParamInput, 200)
.Parameters.Append .CreateParameter ("@orderShippingAmount",
adVarWChar, adParamInput, 25)
.Parameters.Append .CreateParameter ("@orderBrowser", adVarWChar,
adParamInput, 250)
.Parameters.Append .CreateParameter ("@orderGrandTotal", adVarChar,
adParamInput, 25)
.Parameters.Append .CreateParameter ("@orderPaymentMethod",
adVarWChar, adParamInput, 100)
.Parameters.Append .CreateParameter ("@orderCheckAcctNumber",
adVarWChar, adParamInput, 100)
.Parameters.Append .CreateParameter ("@orderCheckNumber",
adVarWChar, adParamInput, 100)
.Parameters.Append .CreateParameter ("@orderBankName", adVarWChar,
adParamInput, 250)
.Parameters.Append .CreateParameter ("@orderRoutingNumber",
adVarWChar, adParamInput, 100)
.Parameters.Append .CreateParameter ("@orderPurchaseOrderName",
adVarWChar, adParamInput, 250)
.Parameters.Append .CreateParameter ("@orderPurchaseOrderNumber",
adVarWChar, adParamInput, 100)
.Parameters.Append .CreateParameter ("@orderRemoteAddress",
adVarWChar, adParamInput, 30)
.Parameters.Append .CreateParameter ("@orderTradingPartner",
adVarWChar, adParamInput, 250)
.Parameters.Append .CreateParameter ("@orderHttpReferrer",
adVarWChar, adParamInput, 250)
IF IsNumeric(iCustID)Then
.Parameters ("@iCustId") = trim(iCustID)
ELSE
.Parameters ("@iCustId") = "0"
END IF
IF IsNumeric(iPayID)Then
.Parameters("@iPayId") = trim(iPayID)
ELSE
.Parameters("@iPayId") = "0"
END IF
If IsNumeric(iAddrID)Then
.Parameters("@iAddrId") = trim(iAddrID)
ELSE
.Parameters("@iAddrId") = "0"
End If
.Parameters("@orderAmount") = trim(sTotalPrice)
IF trim(sShipInstructions) <> "" THEN
.Parameters("@orderComments") = trim(sShipInstructions)
ELSE
.Parameters("@orderComments") = ""
END IF
.Parameters("@orderSTax") = trim(sTotalSTax)
'rsOrder.Fields("orderCTax") = trim(sTotalCTax)
'rsOrder.Fields("orderHandling") = trim(sTotalHandling)

.Parameters("@orderShipMethod") = trim(sShipMethodName)
.Parameters("@orderShippingAmount") = trim(sShipping)
.Parameters("@orderBrowser") =
trim(Request.ServerVariables("HTTP_USER_AGENT"))
.Parameters("@orderGrandTotal") = trim(sGrandTotal)
.Parameters("@orderPaymentMethod") = trim(sPaymentMethod)
IF trim(iCheckingAccountNumber) <> "" THEN
.Parameters("@orderCheckAcctNumber") = trim(iCheckingAccountNumber)
ELSE
.Parameters("@orderCheckAcctNumber") = ""
END IF
IF trim(iCheckNumber) <> "" THEN
.Parameters("@orderCheckNumber") = trim(iCheckNumber)
ELSE
.Parameters("@orderCheckNumber") = ""
END IF
IF trim(sBankName) <> "" THEN
.Parameters("@orderBankName") = trim(sBankName)
ELSE
.Parameters("@orderBankName") = ""
END IF
IF trim(iRoutingNumber) <> "" THEN
.Parameters("@orderRoutingNumber") = trim(iRoutingNumber)
ELSE
.Parameters("@orderRoutingNumber") = ""
END IF
IF trim(iPOName) <> "" THEN
.Parameters("@orderPurchaseOrderName") = trim(iPOName)
ELSE
.Parameters("@orderPurchaseOrderName") = ""
END IF
IF trim(iPONumber) <> "" THEN
.Parameters("@orderPurchaseOrderNumber") = trim(iPONumber)
ELSE
.Parameters("@orderPurchaseOrderNumber") = ""
END IF
if isArray(aReferer) then
on error resume next
IF aReferer(2) <> "" THEN
.Parameters("@orderRemoteAddress") = aReferer(2)
ELSE
.Parameters("@orderRemoteAddress") = ""
END IF
IF aReferer(0) <> "" THEN
.Parameters("@orderTradingPartner") = aReferer(0)
ELSE
.Parameters("@orderTradingPartner") = ""
END IF
IF aReferer(1) <> "" THEN
.Parameters("@orderHttpReferrer") = aReferer(1)
ELSE
.Parameters("@orderHttpReferrer") = ""
END IF
else
.Parameters("@orderRemoteAddress") = ""
.Parameters("@orderTradingPartner") = ""
.Parameters("@orderHttpReferrer") = ""
end if
Dim lngRecs
.Execute

iOrderID = .Parameters("RetVal") 'rsOrder.Fields("orderID")
Jul 20 '05 #1
0 3491

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: dinesh prasad | last post by:
I'm trying to use a servlet to process a form, then send that data to an SQL server stored procedure. I'm using the WebLogic 8 App. server. I am able to retrieve database information, so I know my...
12
by: serge | last post by:
I have an SP that is big, huge, 700-800 lines. I am not an expert but I need to figure out every possible way that I can improve the performance speed of this SP. In the next couple of weeks I...
3
by: Rhino | last post by:
I've spent the last couple of hours trying to figure out how to debug a Java stored procedure and am just going in circles. The last straw came when I got "Cannot open input stream for default"...
7
by: Jeff Wang | last post by:
Hi all, Can someone help me out? I've been struggling with this for almost a week and still have no clue what's wrong. Basically I want to write a DB2 stored procedure for OS/390 in REXX. In...
4
by: Rhino | last post by:
Is it possible for a Java Stored Procedure in DB2 V7.2 (Windows) to pass a Throwable back to the calling program as an OUT parameter? If yes, what datatype should I use when registering the...
1
by: Raquel | last post by:
Have a question on the Stored procedure method code generated by DB2 development center for Java stored procedures. Suppose I have a requirement to return the resultset consisting of FIRSTNME,...
2
by: Kent Lewandowski | last post by:
hi all, Recently I wrote some stored procedures using java jdbc code (admittedly my first stab) and then tried to implement the same within java packages (for code reuse). I encountered...
6
by: Wojciech Wendrychowicz | last post by:
Hello to All, I'm trying to retrieve records from AS/400 in an VBA application. So, I've made an RPG program, then a stored procedure wchich calls that RPG program, and finally some VBA code to...
28
by: mooreit | last post by:
The purpose for my questions is accessing these technologies from applications. I develop both applications and databases. Working with Microsoft C#.NET and Microsoft SQL Server 2000 Production and...
9
by: fniles | last post by:
I am using VB.NET 2003 and SQL2000 database. I have a stored procedure called "INSERT_INTO_MYTABLE" that accepts 1 parameter (varchar(10)) and returns the identity column value from that table....
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.