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. How to solve the Guid.NewGuid() problem

How to solve the Guid.NewGuid() problem

Scheduled Pinned Locked Moved C#
helpdatabasetutorialquestion
4 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.
  • E Offline
    E Offline
    Exelioindia
    wrote on last edited by
    #1

    Hi all, I am struggling with a problem. Please some one suggest me to get out of that. I am working with a existing website developed by some other developer long back. I that he stores the images using name genearated by Guid.NewGuid(), the name of the picture in the folder is difference with this name in database. Now I have to develop a service to delete the images older than 15 days. My problem is i am retrieving the filename from database, but that file name is not equal to the file name in folder. I dnt knw why he used Guid.NewGuid(), can any one please tell me what is the use and advantage of Guid.NewGuid() , also how to solve my issue. Thanks in advance

    Know is Drop, Unknown is Ocean

    N P 2 Replies Last reply
    0
    • E Exelioindia

      Hi all, I am struggling with a problem. Please some one suggest me to get out of that. I am working with a existing website developed by some other developer long back. I that he stores the images using name genearated by Guid.NewGuid(), the name of the picture in the folder is difference with this name in database. Now I have to develop a service to delete the images older than 15 days. My problem is i am retrieving the filename from database, but that file name is not equal to the file name in folder. I dnt knw why he used Guid.NewGuid(), can any one please tell me what is the use and advantage of Guid.NewGuid() , also how to solve my issue. Thanks in advance

      Know is Drop, Unknown is Ocean

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      Exelioindia wrote:

      Guid.NewGuid(),

      It generates a unique GUID.

      Exelioindia wrote:

      Now I have to develop a service to delete the images older than 15 days. My problem is i am retrieving the filename from database, but that file name is not equal to the file name in folder.

      Then you can check the file's creation date and if it is more than 15 days, delete it.

      All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

      E 1 Reply Last reply
      0
      • N N a v a n e e t h

        Exelioindia wrote:

        Guid.NewGuid(),

        It generates a unique GUID.

        Exelioindia wrote:

        Now I have to develop a service to delete the images older than 15 days. My problem is i am retrieving the filename from database, but that file name is not equal to the file name in folder.

        Then you can check the file's creation date and if it is more than 15 days, delete it.

        All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

        E Offline
        E Offline
        Exelioindia
        wrote on last edited by
        #3

        Yor are correct, but along with that i am checking for some other conditions also in database Thanks for you reply

        Know is Drop, Unknown is Ocean

        1 Reply Last reply
        0
        • E Exelioindia

          Hi all, I am struggling with a problem. Please some one suggest me to get out of that. I am working with a existing website developed by some other developer long back. I that he stores the images using name genearated by Guid.NewGuid(), the name of the picture in the folder is difference with this name in database. Now I have to develop a service to delete the images older than 15 days. My problem is i am retrieving the filename from database, but that file name is not equal to the file name in folder. I dnt knw why he used Guid.NewGuid(), can any one please tell me what is the use and advantage of Guid.NewGuid() , also how to solve my issue. Thanks in advance

          Know is Drop, Unknown is Ocean

          P Offline
          P Offline
          Pete OHanlon
          wrote on last edited by
          #4

          Exelioindia wrote:

          I dnt knw why he used Guid.NewGuid(), can any one please tell me what is the use and advantage of Guid.NewGuid()

          This is a common design to get round name collision issues. Basically, you can have two files called Document1.doc from different users - you can only store one of these in a directory, so you need to generate a unique name and associate this with the document. In other words, you rename the file from Document1.doc to your guid named file and you have a mapping in the database that shows the original filename and the new filename.

          Deja View - the feeling that you've seen this post before.

          My blog | My articles

          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