Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. datatype conversion problem when fetching fromn database

datatype conversion problem when fetching fromn database

Scheduled Pinned Locked Moved Visual Basic
databasehelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Ankit Aneja
    wrote on last edited by
    #1

    Hi all, i am fetching float value from SQL select instanceid2400,CAST(weight as float) as GrossWeight from ..... but when i am reading it Private Sub Fetch(ByVal dr As SafeDataReader) 'Load object data from the Database With dr _GrossWeight = .GetDouble("GrossWeight") where _GrossWeight has also datatype as double it's not working fine similarly when i change my query to select instanceid2400,CAST(weight as int) as GrossWeight from ..... _GrossWeight = .Getint32("GrossWeight") it works fine what can be the solution

    Ankit Aneja "Nothing is impossible. The word itself says - I M possible"

    D 1 Reply Last reply
    0
    • A Ankit Aneja

      Hi all, i am fetching float value from SQL select instanceid2400,CAST(weight as float) as GrossWeight from ..... but when i am reading it Private Sub Fetch(ByVal dr As SafeDataReader) 'Load object data from the Database With dr _GrossWeight = .GetDouble("GrossWeight") where _GrossWeight has also datatype as double it's not working fine similarly when i change my query to select instanceid2400,CAST(weight as int) as GrossWeight from ..... _GrossWeight = .Getint32("GrossWeight") it works fine what can be the solution

      Ankit Aneja "Nothing is impossible. The word itself says - I M possible"

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Ankit Aneja wrote:

      With dr _GrossWeight = .GetDouble("GrossWeight") where _GrossWeight has also datatype as double it's not working fine

      So what IS the result?? Are you getting a value?? What is the expected value and what is the actual value returned?? Is there an error message??

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007, 2008

      A 1 Reply Last reply
      0
      • D Dave Kreskowiak

        Ankit Aneja wrote:

        With dr _GrossWeight = .GetDouble("GrossWeight") where _GrossWeight has also datatype as double it's not working fine

        So what IS the result?? Are you getting a value?? What is the expected value and what is the actual value returned?? Is there an error message??

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007, 2008

        A Offline
        A Offline
        Ankit Aneja
        wrote on last edited by
        #3

        just closed my editor and opened again it wrks something strange i din't get Thanks a lot

        Ankit Aneja "Nothing is impossible. The word itself says - I M possible"

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups