Add to Favorites    Make Home Page 2481 Online
 Language Categories
 Source Codes Home Project Ideas New! Interview Questions FAQs Home ASP Home ASP Source Codes ASP Script Directory New! ASP .Net Script Directory New! ASP Interview Questions ASP FAQs ASP How Tos C Home C Source Codes C Script Directory New! C Interview Questions C FAQs C How Tos C++ Home C++ Source Codes C++ Script Directory New! C++ Interview Questions C++ FAQs C++ How Tos Java Home Java Source Codes Java Directory New! Java Interview Questions Java FAQs Java How Tos JavaScript Home JavaScript Directory New! JavaScript Source Codes JavaScript FAQs JavaScript How Tos COBOL Home COBOL Source Codes COBOL FAQs COBOL How Tos Pascal Home Pascal Source Codes Pascal FAQs Pascal How Tos PHP Script Directory New! Python Script Directory New! Perl & CGI Script Directory New! Flash Script Directory New! CFML Script Directory New! Remotely Hosted Scripts New! Tools & Utilities Directory New! XML Script Directory New! Best Programmers Amit Mathur Vishal Bhardwaj Deepesh Jain Vyom NetWork
 Our Services

Home » ASP Home » Math Home » CBit Function

A D V E R T I S E M E N T

Search Projects & Source Codes:

 Title CBit Function Description CBit converts anything to an integer that is suitable for use withMS SQL Server bit fields.CBit ensures that a 1 or 0 will always be returned by the function,regardless of the data type or value of the input expression.CBit returns a 0 or 1 value based on the following criteria (see table).Criteria is applied in the order stated below. Once any criteriais recognized by CBit, no other criteria will be checked to determinethe value of the bit field. In other words, CBit goes with the firstcriteria that matches and then stops testing the variant input andreturns the results of the first applicable test.Variant Argument CBit Returns------------------------------------------------------------------if variant can be converted to sub-type 1string and is considered alpha-numericand if the value is: "on", "true", "y", or "t"if variant can be converted to sub-type 0string and is considered alpha-numericand if the value is: "off", "false", "n", "f", or ""if variant can be converted to a long 1value and is greater than 0if variant can be converted to a long 0value and is less than 0if variant is numeric but raises an error 0when being converted to longif variant is null, empty or an array 0if variant is an object and is set to 1anything other than Nothing if variant is an object and is set to 0Nothingif data type or value of passed variant 0argument is not given a value based onthe above criteriaIf CBit cannot determine the bit status of a particular variant entry,CBit always returns 0. Category ASP » Math Hits 372711 Code Select and Copy the Code <% Private Function CBit(ByVal variantIn) Dim re, bTest, bOut bOut = Null On Error Resume Next Set re = New RegExp With re .Global = False .IgnoreCase = True .Pattern = "^([A-Z-_d]+)\$" bTest = .test(variantIn) End With Set re = Nothing If Err Then bTest = False On Error GoTo 0 If IsNull(bOut) And bTest Then 'alpha-numeric Select Case CStr(LCase(Trim(variantIn))) Case "on", "true", "y", "t" bOut = 1 Case "off", "false", "n", "f", "" bOut = 0 End Select End If If IsNull(bOut) And IsNumeric(variantIn) Then On Error Resume Next variantIn = CLng(variantIn) If Err Then bOut = 0 Else If variantIn > 0 Then _ bOut = 1 Else bOut = 0 End If On Error GoTo 0 End If If IsNull(bOut) And (IsNull(variantIn) Or _ IsEmpty(variantIn) Or IsArray(variantIn)) Then bOut = 0 If IsNull(bOut) And IsObject(variantIn) Then If variantIn Is Nothing Then _ bOut = 0 Else bOut = 1 End If If IsNull(bOut) Then bOut = 0 CBit = bOut End Function %>

Related Source Codes

 Script Name Author ııııııııııııııııııııı VyomWorld Resistor color code reader A.Chermarajan. Telephone Directory dhivya card swapping game (Mini Project) nityanand simple hangman-pascalsource Seabert college dirtectory (Mini Project) msridhar Poll Application John van Meter ASP Daily Hit Counter. Tejaskumar Gandhi To avoid null in asp environment using sql Sami Maklumbalas webmaster poll John van Meter EasyASP Template Engine. TjoekBezoer Basic Calculator using HTML & Javascript. Patrick M. D Souza What servers support ASP ? VyomWorld What is ASP? VyomWorld

A D V E R T I S E M E N T

Subscribe to SourceCodesWorld - Techies Talk
Email:

 Free eBook - Interview Questions: Get over 1,000 Interview Questions in an eBook for free when you join JobsAssist. Just click on the button below to join JobsAssist and you will immediately receive the Free eBook with thousands of Interview Questions in an ebook when you join.

ASP Home | C Home | C++ Home | COBOL Home | Java Home | Pascal Home