Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 15th, 2004, 07:37 AM
Registered User
 
Join Date: Dec 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default can anybody tell why i am getting overflow error

hi,
I am doing a project related to encryption in vb. When i am trying to run it, I am getting an overflow error in the following function at this statement
        n = n + (Mid(Binary, (tpp - s + 1), 1) * (2 ^ (s - 1)))
If I made the statement which calls the function as comment, at the very next statement of that statement again, I am getting the same overflow error.
Here i am also specifying the statement which calls function
        tp = BinaryToDecimal(hrot)
Can anybody tell why i am getting overflow error?

Public Function BinaryToDecimal(Binary As String) As Long

    Dim n As Long
    Dim s As Integer
    Dim tpp As Integer

    tpp = Len(Binary)

    For s = 1 To tpp
        n = n + (Mid(Binary, (tpp - s + 1), 1) * (2 ^ (s - 1)))
    Next s

    BinaryToDecimal = n

End Function

Please help me.

Thanks
tulasi

 
Old December 15th, 2004, 07:58 AM
Registered User
 
Join Date: Feb 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi
Declare
Dim s As Double
Dim tpp As Double

Madhivanan





Similar Threads
Thread Thread Starter Forum Replies Last Post
Arithmetic overflow error gregalb Reporting Services 1 June 24th, 2008 02:42 PM
Find with overflow error EricB123 Excel VBA 0 July 20th, 2007 10:34 AM
Unsolved OverFlow Error maggiefeng Classic ASP Basics 6 December 4th, 2006 07:45 PM
Odd arithmetic overflow error.... 7racer SQL Server 2000 4 May 12th, 2006 09:17 AM
Overflow Error mateenmohd Classic ASP Basics 4 July 5th, 2005 02:12 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.