Re: Returning value using Stored Procedure and ASP



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.


.



Relevant Pages

  • Re: Returning value using Stored Procedure and ASP
    ... After trying to get them into the right datatypes and that not ... varDuration, varTripPlace, varTripPurpose, varChoicesGiven ... As for the conn.InsertTrip technique, you won't find much about this ... Please reply to the newsgroup. ...
    (microsoft.public.inetserver.asp.db)
  • Re: Returning value using Stored Procedure and ASP
    ... do I feel stupid this morning! ... After trying to get them into the right datatypes and that not working, ... varDuration, varTripPlace, varTripPurpose, varChoicesGiven ... A more robust technique would be to get day, ...
    (microsoft.public.inetserver.asp.db)
  • Re: Forward-only recordsets
    ... there are sql statements using '*'. ... When referencing the fields in the recordset, ... It may be an issue with the datatypes. ... Please reply to the newsgroup. ...
    (microsoft.public.data.ado)
  • Re: SQL issue
    ... then stritem2 ... What datatypes are they supposed to be? ... Microsoft MVP -- ASP/ASP.NET ... Please reply to the newsgroup. ...
    (microsoft.public.scripting.vbscript)
  • Re: INSERT from ASP to Access crashes
    ... > cid, uid, u, d, and s are numbers ... The datatypes of the variables are not really relevant. ... > conn.execute myc ... Please reply to the newsgroup. ...
    (microsoft.public.inetserver.asp.general)