Click here to Skip to main content
15,887,945 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello.
I create windows c# application exe file.
I install setup in D:\ ABC_folderName.
I run exe file.Now I enter new reocrd's entry in regestration page in this page I use capture button which capture Image using external camera.
when I click save button It save image in install exe file's drive. ex- D:\ ABC(foldername)\bin\Image(here image save)
all record also save in sqlserver from first user's entry in exe file.this is perfact run and done in my computer.
then i click save record button it display entered record with image on picturebox.

now i install this exe file on another computer, like e:\ ABC (foldername)\bin\Image(here image save)
Now I enter new reocrd's entry in regestration page. also fill all reocord and caputre image from external camera. all done good then click on save button record save successfully. also in database save.
then i click save record button it display entered record with image on picturebox.

now main thing all computers are conncted using LAN.
so first user have installed visual studio 2010 and sql server 2005.

in gridview all record from first computer and second computer's entry both record display.

now when second computer's user wants to see or access record of first user's . second user open gridview select first user's any record. now all text record display but image arise error like path not found.

what can i do???
any code or trick which automatically fetch imagepath and run image or display in form???

note:- 1). computers are connected using LAN.
2). in sqlserver all records are save from first user's and second user's.
Posted

I assume that when you save the file in the database, you are saving a path to the file?
The problem is that that's a local path - it's specific to to computer you are trying to save from, and it won't be available on other computers - it's like expecting a file on a USB stick plugged into my computer to be available on yours!

There really isn't a good solution to this: you need to work out a "common" location that all the computers you expect to be using the images can access, and that they all have read and write permissions to a share.
Alternatively, store them in the DB as an SMB path:
file:\\TheNameOfThePC\TheNameOfTheShare\Images\TheNameOfTheFile.jpg
and make sure that everybody has the right permissions on all of the shares.

[edit]I hate markup! It swallows my double backslash even when disabled...[/edit]
 
Share this answer
 
v2
Comments
Member 11952997 5-Nov-15 5:12am    
sir.
I use this project on network side.
i install setup file and sqlserver in user one pc. and only setup file install in user 2's pc. as per ago discussion error arise.
Whenever you are assigning path for image in window application give path like "
C#
Application.Startuppath
" or "
C#
Application.Executablepath
"(image image folder is at .exe level). this is the best practice.

Please check.
 
Share this answer
 
Comments
Member 11952997 5-Nov-15 5:14am    
sir I use that code given below:

string filename = Path.Combine(Application.StartupPath, "Image", ppath);

but generate error.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900