Results 1 to 5 of 5

Thread: how to store image path in database

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2006
    Posts
    27

    how to store image path in database

    i want to store image path (eg: c:\myproject\myphoto\0001.jpg) to my database
    and show it in picture box

    store in my db like this
    ID: 001
    photo: 001.jpg (rename photo file name to ID + .jpg)

    ID:002
    photo: 002.jpg

    anone have and toturial or example ?

    thanks again
    ekkapop

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: how to store image path in database

    Do you mean you actually want to save the image itself, as opposed to file path?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: how to store image path in database

    If you want just the paths, then build your strings, insert them into the database and rename your files. It should be fairly straight forward with System.IO.
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Feb 2006
    Posts
    27

    Re: how to store image path in database

    i mean to

    1. copy image file into myapplication path/photo/
    2. file name is equal to ID
    3. resize image : )

    can you give me an example or toturials ?

  5. #5
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,521

    Re: how to store image path in database

    For 1 and 2 look at the IO.File namespace. It has a Move procedure which you can use to move and rename.

    example
    VB Code:
    1. IO.File.Move("c:\myPic.jpg", Application.StrartupPath & "/Images/001.jpg")

    And check this out for resizing the image

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