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. C#
  4. Reading the path of a file in C# - URGENT!!

Reading the path of a file in C# - URGENT!!

Scheduled Pinned Locked Moved C#
csharpdatabasehelpquestion
7 Posts 4 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.
  • P Offline
    P Offline
    Phivos Stylianides
    wrote on last edited by
    #1

    Hi, i have tried this line in my project so i can get the path of the images for storing them later in the SQL table but it did not work: byte[] imageData = ReadFile(txtImagePath.Text); I get an error 'ReadFile' does not exist in the current context. In which class does this method belong? Thanks..

    P C R 3 Replies Last reply
    0
    • P Phivos Stylianides

      Hi, i have tried this line in my project so i can get the path of the images for storing them later in the SQL table but it did not work: byte[] imageData = ReadFile(txtImagePath.Text); I get an error 'ReadFile' does not exist in the current context. In which class does this method belong? Thanks..

      P Offline
      P Offline
      PIEBALDconsult
      wrote on last edited by
      #2

      Buy a book.

      1 Reply Last reply
      0
      • P Phivos Stylianides

        Hi, i have tried this line in my project so i can get the path of the images for storing them later in the SQL table but it did not work: byte[] imageData = ReadFile(txtImagePath.Text); I get an error 'ReadFile' does not exist in the current context. In which class does this method belong? Thanks..

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #3

        Read this[^].

        Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

        1 Reply Last reply
        0
        • P Phivos Stylianides

          Hi, i have tried this line in my project so i can get the path of the images for storing them later in the SQL table but it did not work: byte[] imageData = ReadFile(txtImagePath.Text); I get an error 'ReadFile' does not exist in the current context. In which class does this method belong? Thanks..

          R Offline
          R Offline
          Ravenet
          wrote on last edited by
          #4

          Hi ReadFile is method man, but u miss that signature in ur class. check ur code

          Cheers,Earn and Enjoy RRave MCTS,MCPD http://ravesoft.blogspot.com

          P 1 Reply Last reply
          0
          • R Ravenet

            Hi ReadFile is method man, but u miss that signature in ur class. check ur code

            Cheers,Earn and Enjoy RRave MCTS,MCPD http://ravesoft.blogspot.com

            P Offline
            P Offline
            Phivos Stylianides
            wrote on last edited by
            #5

            I know it's a method and i'm asking if it's a predefined method in one of the imported namespaces and if yes which one?

            R 1 Reply Last reply
            0
            • P Phivos Stylianides

              I know it's a method and i'm asking if it's a predefined method in one of the imported namespaces and if yes which one?

              R Offline
              R Offline
              Ravenet
              wrote on last edited by
              #6

              hey there no method like that code snippet.but i think u may be in incorrect way. please tell me wat are try to do? if u want to read file please check File class in the .net 2.0 see here http://msdn2.microsoft.com/en-us/library/system.io.file_methods.aspx[^] thanks

              Cheers,Earn and Enjoy RRave MCTS,MCPD http://ravesoft.blogspot.com

              P 1 Reply Last reply
              0
              • R Ravenet

                hey there no method like that code snippet.but i think u may be in incorrect way. please tell me wat are try to do? if u want to read file please check File class in the .net 2.0 see here http://msdn2.microsoft.com/en-us/library/system.io.file_methods.aspx[^] thanks

                Cheers,Earn and Enjoy RRave MCTS,MCPD http://ravesoft.blogspot.com

                P Offline
                P Offline
                Phivos Stylianides
                wrote on last edited by
                #7

                I skipped the ReadFile method and used something else instead. This is my code so far: try { byte[] image = new byte[4]; string qry = "insert into ITEM(item_picture) values(@OriginalPath)"; command = new SqlCommand(qry,connection); command.Parameters.Add(new SqlParameter("@OriginalPath","~/images/app1.jpg")); } finally { connection.Open(); command.ExecuteNonQuery(); connection.Close(); } I'm trying to execute this within a method every time i add a picture in the table. The table is called ITEM and the column with the type image is called item_picture. And the application root is ~/images/ where i have stored all the images. I get the following error: Operand type clash: nvarchar is incompatible with image Thanks

                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