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. FileGet in VB.Net not returning the same results as in Access

FileGet in VB.Net not returning the same results as in Access

Scheduled Pinned Locked Moved Visual Basic
csharpdatabasehelp
3 Posts 3 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.
  • R Offline
    R Offline
    Regardt
    wrote on last edited by
    #1

    Hi I'm in the process of rewriting a access database type of application, but I run into a problem. This is the Access VB code. dn = FreeFile Open matrix For Binary Access Read As #dn Get #dn, dsn, km Close #dn This the VB.Net code FileNumber = FreeFile() FileOpen(FileNumber, filepath, OpenMode.Binary, OpenAccess.Read, OpenShare.Shared) FileGet(FileNumber, FindValue) To start, I don't none the structure of the file. I'm sending in a search value which should return a result. The VB.Net function isn't returning the same value as the Access VB function. Any ideas why its happening would be appreciated!. Thanks Regardt Africa is a tough country --"Hello daar vir die Afrikaans sprekende"--

    D V 2 Replies Last reply
    0
    • R Regardt

      Hi I'm in the process of rewriting a access database type of application, but I run into a problem. This is the Access VB code. dn = FreeFile Open matrix For Binary Access Read As #dn Get #dn, dsn, km Close #dn This the VB.Net code FileNumber = FreeFile() FileOpen(FileNumber, filepath, OpenMode.Binary, OpenAccess.Read, OpenShare.Shared) FileGet(FileNumber, FindValue) To start, I don't none the structure of the file. I'm sending in a search value which should return a result. The VB.Net function isn't returning the same value as the Access VB function. Any ideas why its happening would be appreciated!. Thanks Regardt Africa is a tough country --"Hello daar vir die Afrikaans sprekende"--

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

      What is returned all depends on the data type of the variable you are reading this data into. If you define FindValue as an Integer, VB.NET will read the first 4 bytes of the file into FileValue. If your defined FindValue at a UInt64, the first 8 bytes will get read. The same is true for the VB code in Access. What is "dsn" and "km" defined as? What is FindValue defined as? BTW: An Integer in VBA and and Integer in VB.NET don't have the same definition. A VBA Integer is 16-bits (2 bytes), while in VB.NET is 32-bits (4 bytes). Also, in the Access code, you're reading two values, where as in the VB.NET code your reading one. Any reason why? RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

      1 Reply Last reply
      0
      • R Regardt

        Hi I'm in the process of rewriting a access database type of application, but I run into a problem. This is the Access VB code. dn = FreeFile Open matrix For Binary Access Read As #dn Get #dn, dsn, km Close #dn This the VB.Net code FileNumber = FreeFile() FileOpen(FileNumber, filepath, OpenMode.Binary, OpenAccess.Read, OpenShare.Shared) FileGet(FileNumber, FindValue) To start, I don't none the structure of the file. I'm sending in a search value which should return a result. The VB.Net function isn't returning the same value as the Access VB function. Any ideas why its happening would be appreciated!. Thanks Regardt Africa is a tough country --"Hello daar vir die Afrikaans sprekende"--

        V Offline
        V Offline
        Virus Detecter
        wrote on last edited by
        #3

        :)Hello You Have not given much information what is the type of file you want.ok if you want to get required string from Test.txt file you can give like this dim str as string("strSearch",10) FileNumber = FreeFile() FileOpen(FileNumber, filepath, OpenMode.Binary, OpenAccess.Read, OpenShare.Shared) FileGet(FileNumber, str) Which Give the result start from 0 To byte 10 bytes if you want to search all give the file size you can give random access also.I hope it will help for you Ishak Progarmmer Analyst ITI KSA

        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