Author |
Topic |
SamC
White Water Yakist
3467 Posts |
Posted - 2003-01-19 : 22:48:28
|
I posted the entire ADO query below, but my question is simple.I have an output parameter in the proc below that is a 100 character string. It returns "Accept" "Deny" or "".I noticed today that when it returns "", the ASP variable strAcknowledge is blank (not ""), and 100 characters long (hence the subject of this post).I've fixed it quickly with a trim, but I'd like to know if this is normal behavior or if I can code it differently so the length of the returned string matches the string length defined by the stored procedure.Sam----------------------- DIM cmdLogPageHit SET cmdLogPageHit = Server.CreateObject("ADODB.Command") WITH cmdLogPageHit .ActiveConnection = application("DBaddr") .CommandText = "dbo.FE_Certificate_HTML" .CommandType = adcmdstoredproc .Parameters.Append .CreateParameter ("@UserID", adInteger, adParamInput, , request.QueryString("UserID")) .Parameters.Append .CreateParameter ("@CourseID", adInteger, adParamInput, , request.QueryString("CourseID")) .Parameters.Append .CreateParameter ("@Fullname", adChar, adParamOutput, 100) .Parameters.Append .CreateParameter ("@Email", adChar, adParamOutput, 100) .Parameters.Append .CreateParameter ("@CourseName", adChar, adParamOutput, 100) .Parameters.Append .CreateParameter ("@CRecordFinish", adDBTimeStamp, adParamOutput) .Parameters.Append .CreateParameter ("@CRecordID", adInteger, adParamOutput) .Parameters.Append .CreateParameter ("@CRAcknowledge", adChar, adParamOutput, 100) .Parameters.Append .CreateParameter ("@Outputmessage", adChar, adParamOutput, 255) .Execute ,,adExecuteNoRecords If CheckADOErrors(.ActiveConnection) Then ' Nothing to do End If strFullname = .Parameters ("@Fullname") strEmail = .Parameters ("@Email") strCourseName = .Parameters ("@CourseName") dateCRecordFinish = .Parameters ("@CRecordFinish") intCRecordID = .Parameters ("@CRecordID") strAcknowledge = trim(.Parameters ("@CRAcknowledge") ) strOutputMessage = .Parameters ("@OutputMessage") ReturnValue = .Parameters("RETURN_VALUE") |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2003-01-19 : 23:36:58
|
Sounds normal to me, you declared the output variable as a char(100), it will return a string of 100 spaces. Try declaring it as varchar instead. |
 |
|
SamC
White Water Yakist
3467 Posts |
Posted - 2003-01-20 : 08:49:44
|
In BOL, the mapping for varchar is adchar. I Reread-bol, downloaded BOL sp-3 just in case. I can't find it. Is there an ADO syntax for output (and input) procedure variables that makes them variable in length?It is length = 0?Sam |
 |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2003-01-20 : 09:31:35
|
Use adVarChar for non-unicode or adVarWChar for unicode/nvarchar mappings. The numeric values are 200 and 202, respectively.The ADO documentation has charts that list all of the possible data type enumerations for an ADO Parameter object. You can find the docs online at MSDN or download the MDAC SDK here:http://www.microsoft.com/data/download.htmDownload and install the SDK and use either the Start menu shortcut for the help file, or look for ADO260.CHM. I don't know why Books Online has its mappings set up the way it does, but it's not up-to-date. |
 |
|
SamC
White Water Yakist
3467 Posts |
Posted - 2003-01-20 : 12:06:27
|
Thanks Rob,I did find the ADO documentation at Microsoft Online, but I'd like to get it installed locally if I can.I've taken some steps to find the ADO documentation. After downloading the mdac_typ.exe from MS, the installation told me I had the current ADO installed from Windows 2000 SP3 (I think). So the install was aborted.The file ADO260.CHM is nowhere on my hard drive. Searching for ADO*.* turned up lots of stuff, but nothing relating to ADO documentation.Sam |
 |
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2003-01-20 : 12:15:15
|
You might want to find the ADO SDK. I think that's where the help docs come from.http://www.microsoft.com/data/download.htm#26SDKinfoMichael<Yoda>Use the Search page you must. Find the answer you will.</Yoda> |
 |
|
SamC
White Water Yakist
3467 Posts |
Posted - 2003-01-20 : 13:22:22
|
Thanks to Rob and Michael for introducing me to SDK.I've found the documentation which I'm sure will be handy for future reference.I've been coding ADO now for not quite a year without the ADO SDK.Have I been missing something major here? Would someone post a short summary about what ADO SDK brings to the table? Sam |
 |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2003-01-20 : 13:43:37
|
I just use the documentation when I need the nitty gritty details of something, I haven't really taken advantage of the other material in it, nor have I felt like I was missing something. I'm sure I've spent a lot of time coding something that might've already been covered in the examples, but I usually like banging my head against something trying to make it work anyway. It's aggravating but it helps me understand it better. I *have* at times regretted using/reusing a code example without really digging into it, but not often. |
 |
|
SamC
White Water Yakist
3467 Posts |
Posted - 2003-01-20 : 14:10:11
|
Thank you for that candid feedback Rob. I'm still open to anyone who might have a life-saver story about sdk. I suspect Rob is right on.Sam |
 |
|
|