Re: Returning value using Stored Procedure and ASP
- From: "Bob Barrows [MVP]" <reb01501@xxxxxxxxxxxxxxx>
- Date: Thu, 28 Feb 2008 12:35:35 -0500
Ah-ha!
Well, don't undo everything! it's important to be cognizant of passing
the correct datatypes!
Drew wrote:
Man, do I feel stupid this morning!
After trying to get them into the right datatypes and that not
working, building a new table with all varchar datatypes and that not
working... I finally found my problem... it is really hard to open a
recordset when you haven't created it... There is a RS above this
code, and after it is run I closed it... just lame-brain, stupid
mistakes... they'll getcha everytime!
Now it works without a hitch... now I need to go back and undo all of
the stuff I did to try to fix it!
Thanks for your help!
Drew
"Bob Barrows [MVP]" <reb01501@xxxxxxxxxxxxxxx> wrote in message
news:eZ7AiEieIHA.6136@xxxxxxxxxxxxxxxxxxxxxxx
OK, back to the asp code:
dim varTripID, varRegNo, varTripDate, varStartTime, varEndTime,
varDuration, varTripPlace, varTripPurpose, varChoicesGiven
varTripDate = Request.Form("TripDate")
varStartTime = Request.Form("StartTime")
varEndTime = Request.Form("EndTime")
varDuration = Request.Form("Duration")
varTripPlace = Request.Form("TripPlace")
varTripPurpose = Request.Form("TripPurpose")
varChoicesGiven = Request.Form("ChoicesGiven")
Ah! Since the procedure is being treated as a method of the
connection object, the datatypes of the parameters need to be
correct.You have to convert these to the proper datatypes:
For illustration:
varTripDate = CDate(Request.Form("TripDate"))
I would not trust the user input unless a calendar control was used
... and even then ...
A more robust technique would be to get day, month and year values
from the form and use DateSerial to cast them as a date.
The same goes for the time values: are users entering them in
military clock format? Or by using AM/PM? And can you count on the
users being consistent? If you use three dropdowns, you can control
the format yourself.
As for the conn.InsertTrip technique, you won't find much about this
technique, which I call the "stored-procedure-as-connection-method"
technique. There is a brief mention in the ADO Documentation - see
the last paragraph of the Connection Object topic.
--
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.
--
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.
.
- Follow-Ups:
- References:
- Returning value using Stored Procedure and ASP
- From: Drew
- Re: Returning value using Stored Procedure and ASP
- From: Bob Barrows [MVP]
- Re: Returning value using Stored Procedure and ASP
- From: Drew
- Re: Returning value using Stored Procedure and ASP
- From: Bob Barrows [MVP]
- Re: Returning value using Stored Procedure and ASP
- From: Drew
- Returning value using Stored Procedure and ASP
- Prev by Date: Re: Returning value using Stored Procedure and ASP
- Next by Date: Re: Returning value using Stored Procedure and ASP
- Previous by thread: Re: Returning value using Stored Procedure and ASP
- Next by thread: Re: Returning value using Stored Procedure and ASP
- Index(es):
Relevant Pages
|
|