All source code in ASP/ VbScript Ask a ASP/ VbScript Pro Discussion Forum Categories All jobs in ASP/ VbScript
Quick Search for:  in language:    
Quickly,find,type,variables,returned,from,you
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
ASP/ VbScript Stats

 Code: 281,486. lines
 Jobs: 101. postings

 How to support the site

 
Sponsored by:

 
You are in:
 
Login

NEW! LEARNING CENTER
Special educational offers, white papers, webcasts, podcasts

  NEW! Download Rational Performance Tester V8 (download now)
  NEW! Download Rational Functional Tester V8 (download now)
  NEW! Download Rational Service Tester for SOA Quality V8 (download now)
  NEW! Teleconference: Quality In Action - Using Rational Quality Manager with Functional, Performance and Web Service Testing Products (download now)
  NEW! Introducing IBM Rational AppScan Developer Edition – easing security testing by non-security professionals (download now)

 

 


Latest postings for ASP/ VbScript.
Click here to see a screenshot of this code!Mess Officer Management System (Sistem Pengurusan Mess Pegawai)
By Mohd Fauzi on 11/23

(Screen Shot)

Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!



 
 
   

ADODBTypeName

Print
Email
 
VB icon
Submitted on: 4/21/2002 8:52:45 PM
By: Lewis E. Moten III  
Level: Beginner
User Rating: By 2 Users
Compatibility:ASP (Active Server Pages)

Users have accessed this code 10113 times.
 
author picture
(About the author)
 
     Quickly find out the type of variables returned from your adodb recordset. TypeName() function doesn't do the trick. Databases offer additional data types. This script helps solve type problems without having to lookup the name of the numbers returned.
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.

    '**************************************
    ' Name: ADODBTypeName
    ' Description:Quickly find out the type 
    '     of variables returned from your adodb re
    '     cordset. TypeName() function doesn't do 
    '     the trick. Databases offer additional da
    '     ta types. This script helps solve type p
    '     roblems without having to lookup the nam
    '     e of the numbers returned.
    ' By: Lewis E. Moten III
    '
    'This code is copyrighted and has    ' limited warranties.Please see http://w
    '     ww.Planet-Source-Code.com/vb/scripts/Sho
    '     wCode.asp?txtCodeId=7470&lngWId=4    'for details.    '**************************************
    
    Response.write ADODBTypeName(Rs.Fields("UserID").Type)
    function ADODBTypeName(ByRef plngType)
    	Select Case plngType
    		Case 0:ADODBTypeName="adEmpty"
    		Case 2:ADODBTypeName="adSmallInt"
    		Case 3:ADODBTypeName="adInteger"
    		Case 4:ADODBTypeName="adSingle"
    		Case 5:ADODBTypeName="adDouble"
    		Case 6:ADODBTypeName="adCurrency"
    		Case 8:ADODBTypeName="adBSTR"
    		Case 9:ADODBTypeName="adDispatch"
    		Case 10:ADODBTypeName="adError"
    		Case 11:ADODBTypeName="adBoolean"
    		Case 12:ADODBTypeName="adVariant"
    		Case 13:ADODBTypeName="adIUnknown"
    		Case 14:ADODBTypeName="adDecimal"
    		Case 16:ADODBTypeName="adTinyInt"
    		Case 17:ADODBTypeName="adUnsignedTinyInt"
    		Case 18:ADODBTypeName="adUnsignedSmallInt"
    		Case 19:ADODBTypeName="adUnsignedInt"
    		Case 21:ADODBTypeName="adUnsignedBigInt"
    		Case 64:ADODBTypeName="adFileTime"
    		Case 72:ADODBTypeName="adGUID"
    		Case 20:ADODBTypeName="adBigInt"
    		Case 128:ADODBTypeName="adBinary"
    		Case 129:ADODBTypeName="adChar"
    		Case 130:ADODBTypeName="adWChar"
    		Case 131:ADODBTypeName="adNumeric"
    		Case 132:ADODBTypeName="adUserDefined"
    		Case 133:ADODBTypeName="adDBDate"
    		Case 134:ADODBTypeName="adDBTime"
    		Case 135:ADODBTypeName="adDBTimeStamp"
    		Case 136:ADODBTypeName="adChapter"
    		Case 137:ADODBTypeName="adDBFileTime"
    		Case 138:ADODBTypeName="adPropVariant"
    		Case 139:ADODBTypeName="adVarNumeric"
    		Case 200:ADODBTypeName="adVarChar"
    		Case 201:ADODBTypeName="adLongVarChar"
    		Case 202:ADODBTypeName="adVarWChar"
    		Case 203:ADODBTypeName="adLongVarWChar"
    		Case 204:ADODBTypeName="adVarBinary"
    		Case 205:ADODBTypeName="adLongVarBinary"
    	End Select
    End function


Other 102 submission(s) by this author

 

 
 Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:
 
Your Vote!

What do you think of this code(in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
5/18/2002 2:27:01 AMneil@efc.be

First, thanks for all your submissions. They are appreciated.
In the ADODBTypeName description you state that TypeName() doesn't do the trick. Could you be a bit more specific as I have been using it quite a lot recently.

Ta

Neil
(If this comment was disrespectful, please report it.)

 
5/21/2002 8:39:05 AMLewis Moten

TypeName has problems because you can't determine between specific types. You can do a test by creating a table with all the different data types. Select all fields from the table and do a typename on each one. You'll see that some are the same when they are not.
(If this comment was disrespectful, please report it.)

 
7/15/2003 5:55:45 AM

useful snippet, thanks!

but with select case statements i always use a case else at the end..it's safer in case you haven't covered all of the possible options.

ie:

Case Else: ADODBTypeName="UNKNOWN"
End Select
(If this comment was disrespectful, please report it.)

 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author from the email account you registered on the site, so you can correspond directly.

NOTICE: The author of this code has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular code, please click here.
 
To post feedback, first please login.


 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | ASP/ VbScript Home | Site Home | Other Sites | Open Letter from Moderators | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997-2008 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.   Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.