Results 1 to 6 of 6

Thread: How come this statement is false?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Mar 2004
    Location
    Orlando, FL
    Posts
    1,618

    How come this statement is false?

    How come the following statement isn't true? Where the value of drDataRow.Item("CG_VEND_NBR") is 2 {long}???????

    If DirectCast(drDataRow.Item("CG_VEND_NBR"), System.Int64) = 2 Then
    ' Do something
    End If
    Sean

    Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    my guess (even though I dont know what this code is or does) is that just because

    drDataRow.Item("CG_VEND_NBR") = 2

    doesn't mean that

    DirectCast(drDataRow.Item("CG_VEND_NBR"), System.Int64) = 2

    try debuging to see what the value is when you do

    DirectCast(drDataRow.Item("CG_VEND_NBR"), System.Int64)

    and see what the value is

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Mar 2004
    Location
    Orlando, FL
    Posts
    1,618
    I checked it, it's 2 {long} still. Thanks for the input though.
    Sean

    Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    Originally posted by SeanGrebey
    I checked it, it's 2 {long} still. Thanks for the input though.
    Bit wise they are not the same.... DirectCast your 2 to a Int64 and see if yo uthen get the desired results.

    TG
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Mar 2004
    Location
    Orlando, FL
    Posts
    1,618
    Bizarre, I have a break point here, and I did an evaluate on the : DirectCast(drDataRow.Item("CG_VEND_NBR"), System.Int64) = 2 part, and it evaluates to true, but it doesn't step into the loop. I don't get it.

    If DirectCast(drDataRow.Item("CG_VEND_NBR"), System.Int64) = 2 Then
    ' Do something
    End If
    Sean

    Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.

  6. #6
    Hyperactive Member CyberHawke's Avatar
    Join Date
    May 2004
    Location
    Washington DC
    Posts
    477
    Sean,

    If I were coding this, I would declare a constant of type Int64 and assign it the value "2" and then compare your DirectCast value to that.

    John
    Whadayamean it doesn't work....
    It works fine on my machine!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width