I have a method which contains a file upload control. It uses the .saveas property to save the file to the physical location.
Then in my code I have a table adapter which inserts the file location to the database.
In the database a new GUID is created per new insert.
I would like to grab the GUID from the recently inserted row and append it to the start of the filename. Therefore do I let the method save the file, insert to the database and then rename the physical file with the GUID or is there another way ?
I am defining my GUID like this:
Guid GID = System.Guid.NewGuid();
Then i have this:
int FileUploadNew = FileUploadAdapter.InsertFileUpload(GID, path1);
The GUID column in the database is NVARCHAR (MAX)
Any ideas?
** Update **
fixed by using this: string GID = System.Guid.NewGuid().ToString();
Also you can create your own GUID and send it to database when saving the file
Guid.NewGuid()