windows c#application的exe反映了另一台计算机上的图像路径错误 [英] exe of windows c# application reflect image path error on another computer

查看:53
本文介绍了windows c#application的exe反映了另一台计算机上的图像路径错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好。

我创建了windows c#application exe文件。

我在D:\ ABC_folderName中安装设置。

我运行exe file.Now我在此页面的regestration页面输入新reocrd的条目我使用捕获按钮,使用外部摄像头捕获图像。

当我点击保存按钮它将图像保存在安装exe文件的驱动器中。 ex-D:\ ABC(foldername)\ bin \ Image(这里是图片保存)

所有记录也保存在sqlserver中,来自第一个用户在exe文件中的条目。这是完全运行并完成的我的电脑。

然后我点击保存记录按钮显示输入记录,图片放在图片框上。



现在我将这个exe文件安装到另一个计算机,如e:\ ABC(foldername)\ bin \ Image(这里图像保存)

现在我在regestration页面输入新的reocrd条目。还可以从外部相机填充所有reocord和caputre图像。一切顺利,然后点击保存按钮记录保存成功。也在数据库保存。

然后我点击保存记录按钮它显示输入记录与图像在图片框上。



现在所有电脑都是主要的东西使用局域网连接。

所以第一个用户安装了visual studio 2010和sql server 2005.



在gridview中所有记录来自第一台计算机和第二台计算机的条目都记录当第二台计算机的用户想要查看或访问第一位用户的记录时,显示。



。第二个用户打开gridview选择第一个用户的任何记录。现在所有文本记录显示但图像出现错误,如路径未找到。



我能做什么???

任何代码或技巧哪个自动获取imagepath并运行图像或以表格形式显示???



注意: - 1)。计算机使用LAN连接。

2)。在sqlserver中,所有记录都是从第一个用户和第二个用户保存的。

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.

推荐答案

我假设当您将文件保存在数据库中时,您将保存文件的路径?

问题在于,这是一条本地路径 - 它特定于您试图保存的计算机,并且在其他计算机上无法使用 - 就像期待USB记忆棒上的文件一样插入我的电脑就可以在你的电脑上使用了!



确实没有一个很好的解决方案:你需要找出一个所有的共同位置您希望使用图像的计算机可以访问,并且它们都具有对共享的读写权限。

或者,将它们作为SMB路径存储在数据库中:

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

并确保每个人都有权利所有股票的权限。



我讨厌加价!即使在禁用时它也会吞下我的双反斜杠... [/ edit]

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]


每当你在窗口应用程序中为图像分配路径时,给出路径,如
Whenever you are assigning path for image in window application give path like "
Application.Startuppath

Application.Executablepath

(图像图像文件夹处于.exe级别)。这是最好的做法。



请检查。

"(image image folder is at .exe level). this is the best practice.

Please check.


这篇关于windows c#application的exe反映了另一台计算机上的图像路径错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆