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=SQLOLE DB;Data Source=192.168. 1.2;Initial
Catalog=myDatab ase;Network Library=DBMSSOC N;Persist Security
Info=True;User Id=myUser;Passw ord=myPassword
The web server and the sql server are directly connected using a
crossover cable. Now for the sproc:
CREATE PROCEDURE myUser.sp_order Inital
@iCustID VarChar(40),
@iPayID VarChar(40),
@iAddrID VarChar(40),
@orderAmount VarChar(25),
@orderComments NText,
@orderSTax VarChar(25),
@orderShipMetho d VarChar(200),
@orderShippingA mount VarChar(25),
@orderBrowser VarChar(250),
@orderGrandTota l VarChar(25),
@orderPaymentMe thod VarChar(100),
@orderCheckAcct Number VarChar(100),
@orderCheckNumb er VarChar(100),
@orderBankName VarChar(250),
@orderRoutingNu mber VarChar(100),
@orderPurchaseO rderName VarChar(250),
@orderPurchaseO rderNumber VarChar(100),
@orderRemoteAdd ress VarChar(30),
@orderTradingPa rtner VarChar(250),
@orderHttpRefer rer VarChar(250)
AS
DECLARE @orderID INT
INSERT INTO sfOrders (orderCustId, orderPayId, orderAddrId,
orderAmount, orderComments, orderSTax, orderShipMethod ,
orderShippingAm ount, orderGrandTotal , orderPaymentMet hod,
orderCheckAcctN umber, orderCheckNumbe r, orderBankName,
orderRoutingNum ber, orderPurchaseOr derName,
orderPurchaseOr derNumber,
orderRemoteAddr ess, orderHttpReferr er, orderTradingPar tner,
orderBrowser)
VALUES (@iCustID, @iPayID, @iAddrID,
@orderAmount, @orderComments, @orderSTax, @orderShipMetho d,
@orderShippingA mount, @orderGrandTota l, @orderPaymentMe thod,
@orderCheckAcct Number, @orderCheckNumb er, @orderBankName,
@orderRoutingNu mber, @orderPurchaseO rderName,
@orderPurchaseO rderNumber,
@orderRemoteAdd ress, @orderHttpRefer rer, @orderTradingPa rtner,
@orderBrowser)
SELECT @orderID = @@IDENTITY
RETURN @orderID
GO
*************** *************** *************** ***********
Now the asp code starts
*************** *************** *************** ***********
Dim iOrderID
Dim cmdOrders
Set cmdOrders = Server.CreateOb ject("ADODB.Com mand")
With cmdOrders
.ActiveConnecti on = cnn
.CommandText = "bradley.sp_Ord erInital"
.CommandType = adCmdStoredProc
'sdfsdfsdff;sdf sd;
.Parameters.App end .CreateParamete r ("RetVal", adVarWChar,
adParamReturnVa lue, 40)
.Parameters.App end .CreateParamete r ("@iCustID", adVarWChar,
adParamInput, 40)
.Parameters.App end .CreateParamete r ("@iPayID", adVarWChar,
adParamInput, 40)
.Parameters.App end .CreateParamete r ("@iAddrID", adVarWChar,
adParamInput, 40)
.Parameters.App end .CreateParamete r ("@orderAmount" , adVarWChar,
adParamInput, 25)
.Parameters.App end .CreateParamete r ("@orderComment s",
adLongVarWChar, adParamInput, 4000)
.Parameters.App end .CreateParamete r ("@orderSTax ", adVarWChar,
adParamInput, 25)
.Parameters.App end .CreateParamete r ("@orderShipMet hod", adVarWChar,
adParamInput, 200)
.Parameters.App end .CreateParamete r ("@orderShippin gAmount",
adVarWChar, adParamInput, 25)
.Parameters.App end .CreateParamete r ("@orderBrowser ", adVarWChar,
adParamInput, 250)
.Parameters.App end .CreateParamete r ("@orderGrandTo tal", adVarChar,
adParamInput, 25)
.Parameters.App end .CreateParamete r ("@orderPayment Method",
adVarWChar, adParamInput, 100)
.Parameters.App end .CreateParamete r ("@orderCheckAc ctNumber",
adVarWChar, adParamInput, 100)
.Parameters.App end .CreateParamete r ("@orderCheckNu mber",
adVarWChar, adParamInput, 100)
.Parameters.App end .CreateParamete r ("@orderBankNam e", adVarWChar,
adParamInput, 250)
.Parameters.App end .CreateParamete r ("@orderRouting Number",
adVarWChar, adParamInput, 100)
.Parameters.App end .CreateParamete r ("@orderPurchas eOrderName",
adVarWChar, adParamInput, 250)
.Parameters.App end .CreateParamete r ("@orderPurchas eOrderNumber",
adVarWChar, adParamInput, 100)
.Parameters.App end .CreateParamete r ("@orderRemoteA ddress",
adVarWChar, adParamInput, 30)
.Parameters.App end .CreateParamete r ("@orderTrading Partner",
adVarWChar, adParamInput, 250)
.Parameters.App end .CreateParamete r ("@orderHttpRef errer",
adVarWChar, adParamInput, 250)
IF IsNumeric(iCust ID)Then
.Parameters ("@iCustId") = trim(iCustID)
ELSE
.Parameters ("@iCustId") = "0"
END IF
IF IsNumeric(iPayI D)Then
.Parameters("@i PayId") = trim(iPayID)
ELSE
.Parameters("@i PayId") = "0"
END IF
If IsNumeric(iAddr ID)Then
.Parameters("@i AddrId") = trim(iAddrID)
ELSE
.Parameters("@i AddrId") = "0"
End If
.Parameters("@o rderAmount") = trim(sTotalPric e)
IF trim(sShipInstr uctions) <> "" THEN
.Parameters("@o rderComments") = trim(sShipInstr uctions)
ELSE
.Parameters("@o rderComments") = ""
END IF
.Parameters("@o rderSTax") = trim(sTotalSTax )
'rsOrder.Fields ("orderCTax" ) = trim(sTotalCTax )
'rsOrder.Fields ("orderHandling ") = trim(sTotalHand ling)
.Parameters("@o rderShipMethod" ) = trim(sShipMetho dName)
.Parameters("@o rderShippingAmo unt") = trim(sShipping)
.Parameters("@o rderBrowser") =
trim(Request.Se rverVariables(" HTTP_USER_AGENT "))
.Parameters("@o rderGrandTotal" ) = trim(sGrandTota l)
.Parameters("@o rderPaymentMeth od") = trim(sPaymentMe thod)
IF trim(iCheckingA ccountNumber) <> "" THEN
.Parameters("@o rderCheckAcctNu mber") = trim(iCheckingA ccountNumber)
ELSE
.Parameters("@o rderCheckAcctNu mber") = ""
END IF
IF trim(iCheckNumb er) <> "" THEN
.Parameters("@o rderCheckNumber ") = trim(iCheckNumb er)
ELSE
.Parameters("@o rderCheckNumber ") = ""
END IF
IF trim(sBankName) <> "" THEN
.Parameters("@o rderBankName") = trim(sBankName)
ELSE
.Parameters("@o rderBankName") = ""
END IF
IF trim(iRoutingNu mber) <> "" THEN
.Parameters("@o rderRoutingNumb er") = trim(iRoutingNu mber)
ELSE
.Parameters("@o rderRoutingNumb er") = ""
END IF
IF trim(iPOName) <> "" THEN
.Parameters("@o rderPurchaseOrd erName") = trim(iPOName)
ELSE
.Parameters("@o rderPurchaseOrd erName") = ""
END IF
IF trim(iPONumber) <> "" THEN
.Parameters("@o rderPurchaseOrd erNumber") = trim(iPONumber)
ELSE
.Parameters("@o rderPurchaseOrd erNumber") = ""
END IF
if isArray(aRefere r) then
on error resume next
IF aReferer(2) <> "" THEN
.Parameters("@o rderRemoteAddre ss") = aReferer(2)
ELSE
.Parameters("@o rderRemoteAddre ss") = ""
END IF
IF aReferer(0) <> "" THEN
.Parameters("@o rderTradingPart ner") = aReferer(0)
ELSE
.Parameters("@o rderTradingPart ner") = ""
END IF
IF aReferer(1) <> "" THEN
.Parameters("@o rderHttpReferre r") = aReferer(1)
ELSE
.Parameters("@o rderHttpReferre r") = ""
END IF
else
.Parameters("@o rderRemoteAddre ss") = ""
.Parameters("@o rderTradingPart ner") = ""
.Parameters("@o rderHttpReferre r") = ""
end if
Dim lngRecs
.Execute
iOrderID = .Parameters("Re tVal") 'rsOrder.Fields ("orderID") 0 3527 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 application
server can talk to the database.
I've determined the failure occurs when the the following statement is
executed: cstmt.execute(); (due to the failure of println statements
placed afterwards). I get the following error after trying to...
|
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 will work on preparing SQL statements
that will create the tables, insert sample record and run the SP.
I would hope people will look at my SP and give me any hints on how
I can better write the SP.
|
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" when I launched the IBM
Distributed Debugger via
D:\IBMDebug>idebug.exe -qdaemon -quiport=8000,8001
First, a bit of background.
I am running DB2 V7.2 with Fixpack 9 applied on Windows XP Professional (all
critical service applied). I've written...
|
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 this procedure it reads a dataset and return the first line of the
dataset. I met two problems:
Problem 1:
|
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 Throwable as an OUT
parameter and what datatype should I use in the CREATE PROCEDURE and DROP
PROCEDURE statements?
Here's what I tried:
- the method signature for the stored procedure included: Throwable
throwable
| |
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, LASTNAME of all employees belonging to a particular
department, following is the stored procedure method code generated by
"DB2 development center":
public static void sproc3mtd ( String workdept,
String firstnme,
|
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 problems doing this.
I wanted to implemented a generic "Helper" class like this:
/**
* Helper
|
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 call the stored procedure and retrieve
data from AS/400.
The problem is, that when I finally run my VB code, it just hangs.
But when I call the same stored procedure from "pure" SQL - it works
perfect. (I evaluate Aqua Data Studio 3.7)
What I...
|
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 2005 Test
Environments.
What is the purpose of a view if I can just copy the vode from a view
and put it into a stored procedure?
Should I be accessing views from stored procedures?
|
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.
When calling the stored procedure from VB.NET, in the CommandText, can I
just say "INSERT_INTO_MYTABLE '12345'" instead of calling it with
"INSERT_INTO_MYTABLE" then do the following :
OleDbCommand2.Parameters.Add("@Account", SqlDbType.VarChar, 10)...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |