Hi everyone,
I have a sql store procedure which accept three parameters and for the first
time I call this store procedure, it seems fine, but when I call it second
time in the program with the same code, it seems it memorizes the old three
parameters I appended the first time and it gives me the error message as
specified in the subject line. I just don't know how to avoid it.
I need to call in the program for multiple times, any suggestions I should do?
I just cannot think of a good way to do it.
Thank you.
Betty
cmdTemp.CommandText = "RecordTxn"
cmdTemp.CommandType = adCmdStoredProc
Set paramOrderID=cmdTemp.CreateParameter("@orderID", adVarChar,
adParamInput,26)
Response.Write order_id
'Response.End
paramOrderID.value=order_id
cmdTemp.Parameters.Append paramOrderID
Set paramNo=cmdTemp.CreateParameter("@no", adChar, adParamInput,26)
paramNo.value=trim(Request("number"))
cmdTemp.Parameters.Append paramNo
Set paramExpDate=cmdTemp.CreateParameter("@date", adChar, adParamInput,4)
paramDate.value=str_date
cmdTemp.parameters.Append paramDate
cmdTemp.Execute
--
Betty 2 4378
c676228 wrote:
Hi everyone,
I have a sql store procedure which accept three parameters and for
the first time I call this store procedure, it seems fine, but when I
call it second time in the program with the same code, it seems it
memorizes the old three parameters I appended the first time and it
gives me the error message as specified in the subject line. I just
don't know how to avoid it.
I need to call in the program for multiple times, any suggestions I
should do? I just cannot think of a good way to do it.
Thank you.
Betty
cmdTemp.CommandText = "RecordTxn"
cmdTemp.CommandType = adCmdStoredProc
Set paramOrderID=cmdTemp.CreateParameter("@orderID", adVarChar,
adParamInput,26)
Response.Write order_id
'Response.End
paramOrderID.value=order_id
cmdTemp.Parameters.Append paramOrderID
Set paramNo=cmdTemp.CreateParameter("@no", adChar, adParamInput,26)
paramNo.value=trim(Request("number"))
Always validate user inputs before using them!
cmdTemp.Parameters.Append paramNo
Set paramExpDate=cmdTemp.CreateParameter("@date", adChar,
Why are you storing a date in a Char field rather than a datetime field?
adParamInput,4) paramDate.value=str_date
cmdTemp.parameters.Append paramDate
cmdTemp.Execute
Well, you have no output parameters, so I would suggest, instead of the
explicit Command object, using the "procedure-as-connection-method"
technique (see my previous reply for the link I posted.) In this case,
assuming "conn" is the name of your connection variable:
dim num
num=trim(Request("number"))
if not IsValid(num) then
Response.Write num & " is not valid"
Response.End
end if
conn.RecordTxn order_id, num, str_date
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Thanks for your expert opinion, Bob.
Yep, it works better to use your way. it also reduces the number of lines of
code.
str_date is just a string like '0708', not a real date.
--
Betty
"Bob Barrows [MVP]" wrote:
c676228 wrote:
Hi everyone,
I have a sql store procedure which accept three parameters and for
the first time I call this store procedure, it seems fine, but when I
call it second time in the program with the same code, it seems it
memorizes the old three parameters I appended the first time and it
gives me the error message as specified in the subject line. I just
don't know how to avoid it.
I need to call in the program for multiple times, any suggestions I
should do? I just cannot think of a good way to do it.
Thank you.
Betty
cmdTemp.CommandText = "RecordTxn"
cmdTemp.CommandType = adCmdStoredProc
Set paramOrderID=cmdTemp.CreateParameter("@orderID", adVarChar,
adParamInput,26)
Response.Write order_id
'Response.End
paramOrderID.value=order_id
cmdTemp.Parameters.Append paramOrderID
Set paramNo=cmdTemp.CreateParameter("@no", adChar, adParamInput,26)
paramNo.value=trim(Request("number"))
Always validate user inputs before using them!
cmdTemp.Parameters.Append paramNo
Set paramExpDate=cmdTemp.CreateParameter("@date", adChar,
Why are you storing a date in a Char field rather than a datetime field?
adParamInput,4) paramDate.value=str_date
cmdTemp.parameters.Append paramDate
cmdTemp.Execute
Well, you have no output parameters, so I would suggest, instead of the
explicit Command object, using the "procedure-as-connection-method"
technique (see my previous reply for the link I posted.) In this case,
assuming "conn" is the name of your connection variable:
dim num
num=trim(Request("number"))
if not IsValid(num) then
Response.Write num & " is not valid"
Response.End
end if
conn.RecordTxn order_id, num, str_date
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Penn Markham |
last post by:
Hello all,
I am writing a script where I need to use the system() function to call
htpasswd. I can do this just fine on the command line...works great
(see attached file, test.php). When my...
|
by: Justin |
last post by:
I am trying to do a simple update of a database using a stored procedure. I
have get the following error when executing the code:
"Procedure or function UpdateDetails has too many arguments...
|
by: Child |
last post by:
Hi, I am getting the error: "Procedure or function spAddActivity has too
many arguments specified. " on a stored procedure insert. I compared the
number of parameters in the function and the SP...
|
by: M K |
last post by:
Heres my SP: ( i am trying to add more than 1 field but get the same error
no matter how many i try to add, i thought i would try to insert the primary
key only and work up from there but the...
|
by: Mike P |
last post by:
I am using a SqlDataSource with a GridView and stored proc, and I have
specified exactly the same update parameters for the SqlDataSource in
exactly the same order as my stored proc. Yet I keep...
|
by: jkeel |
last post by:
If I try to Update a record with the following code using a stored
procedure I get an error:
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$...
|
by: sun919 |
last post by:
hi there... i ve a little question asking concerning saving data into
database
Basically, I have stored procedure name InsertquestionnaireList and the
argument for this is both correct
... I...
|
by: David Lozzi |
last post by:
Howdy,
ASP.Net 2.0 using VB on SQL 2005
This is a two fold issue.
I have a DetailsView control which users can insert or edit items. Editing
works great. Insert works great however I need...
|
by: speranza |
last post by:
i have multiple checkboxes on my form.i am trying to add them with stored procedure but it gives me Procedure or function konut_ekle has too many arguments specified
protected void...
|
by: Kemmylinns12 |
last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
|
by: Naresh1 |
last post by:
What is WebLogic Admin Training?
WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
|
by: Matthew3360 |
last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function.
Here is my code.
header("Location:".$urlback);
Is this the right layout the...
|
by: Matthew3360 |
last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it so the python app could use a http request to get...
|
by: WisdomUfot |
last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
|
by: Matthew3360 |
last post by:
Hi,
I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
|
by: Oralloy |
last post by:
Hello Folks,
I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA.
My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
|
by: Rahul1995seven |
last post by:
Introduction:
In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
|
by: Ricardo de Mila |
last post by:
Dear people, good afternoon...
I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control.
Than I need to discover what...
| |