Get ready for BLACK FRIDAY shopping starting in

Forums

This topic is locked

UD4 Stored Procedure NEWBIE questions...

Posted 03 Apr 2002 04:47:17
1
has voted
03 Apr 2002 04:47:17 b w posted:
UD4, SQL 2000

2 questions.

1st one is:
I cannot insert decimals using the "insert" in UD4. ie 0.5
default is numeric in UD4 and I have set up decimal as the datatype in the table.
Some mentioned that you need to use the CAST or the CONVERT function to change it from a varchar to a decimal.
My stored procedure experience is limited.
Is there another way to insert decimals?

2nd question.
Does the stored procedure execute when the page loads or when the submit button is pressed and info is sent to server?ie I want to insert data using a stored procedure into a table from a form. In UD4, the stored procedure is a command so I am wondering when the command will get executed.


Replies

Replied 03 Apr 2002 07:06:19
03 Apr 2002 07:06:19 b w replied:
I got question number 1 solved.
Just put "scale" to 1 or 2 and leave precision at 18. It will leave the decimals inputted as decimals.

Replied 03 Apr 2002 08:06:33
03 Apr 2002 08:06:33 Viktor Farcic replied:
If you simply insert Stored Procedure, it will be executed whenever that page loads. If SP is on the same page as form, you'll probably need to create Hidden Field in order to determine if Stored Procedure should be executed.
For example:
1. Among other fields, create hidden field with name="SPExecute" and value="True"
2. Modify the SP code. Something like:
<%
If Request.Form("SPExecute" <> "" Then
*** Stored Procedure Code ***
End If
%>

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
UD4, SQL 2000

2 questions.

1st one is:
I cannot insert decimals using the "insert" in UD4. ie 0.5
default is numeric in UD4 and I have set up decimal as the datatype in the table.
Some mentioned that you need to use the CAST or the CONVERT function to change it from a varchar to a decimal.
My stored procedure experience is limited.
Is there another way to insert decimals?

2nd question.
Does the stored procedure execute when the page loads or when the submit button is pressed and info is sent to server?ie I want to insert data using a stored procedure into a table from a form. In UD4, the stored procedure is a command so I am wondering when the command will get executed.



<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Viktor Farcic

TalkZone Manager

Edited by - vfarcic on 03 Apr 2002 17:14:34
Replied 04 Apr 2002 02:50:06
04 Apr 2002 02:50:06 b w replied:
After testing some stored procedures, I finally see how it works. The first page contains the parameters and submits to the second page. The Second page contains the Stored procedures that takes the parameters and processes it and (could) returns values from the server.
So (if this is correct) I know how to configure the asp pages to work with stored procedures.
For some reason I thought the stored procedures and parameters were to be on one page.
Thanks Viktor!

Replied 04 Apr 2002 08:28:50
04 Apr 2002 08:28:50 Viktor Farcic replied:
I always use Stored Procedures on the same page where Form/Parameters are. My previous response (the one with "If...Then..." was addressing "one page" solution. My philosophy is: "Never use two pages for something that can be done on one".

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
After testing some stored procedures, I finally see how it works. The first page contains the parameters and submits to the second page. The Second page contains the Stored procedures that takes the parameters and processes it and (could) returns values from the server.
So (if this is correct) I know how to configure the asp pages to work with stored procedures.
For some reason I thought the stored procedures and parameters were to be on one page.
Thanks Viktor!


<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Viktor Farcic

TalkZone Manager

Reply to this topic