I’m want to save an image to a sql server DB by using it’s path, that i don’t want to save the image it self i just want when i upload an image to my form and when i click in a button this button upload the image to the application folder then save the path of this picture to the databasen, How can I do that ?
2 – how can i add this picture to a dataGridView ?
NOTE : I’m using C# as a programming language.
Getting the image file path can be done using OpenFileDialog.
This answer can help you getting file path Extracting Path from OpenFileDialog path/filename
1) You can copy them using
File.Copy(path, path2)function to your app directory :string path = Directory.GetCurrentDirectory();2) You need to use Bitmap to get your image loaded from its file path :
And then you can add it to a
DataGridViewassuming that containsDataGridViewImageColumn