发布VS2010项目以在其他PC上运行

编程入门 行业动态 更新时间:2024-10-15 06:18:10
本文介绍了发布VS2010项目以在其他PC上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

好的,这可能是一个愚蠢的问题,但是我已经在PC上编写了一个程序,并在PC上对其进行了测试,现在我想先在儿子的笔记本电脑上对其进行测试,然后再将其发送给我的人已经写了. 但是,当我在他的PC上安装并运行它时,由于SQL Server错误而失败,并且我认为这是由于该程序中包含一个硬编码的Connection,上面写着"Data Source = MEDESKTOP; Initial Catalog = KAELC; Integrated Security = True" ...他的PC显然不称为MEDESKTOP,我也不知道最终用户的PC将被称为...

OK, this might be a stupid question, but I have written a program on my PC and tested it on my PC & I now want to test it on my son''s laptop before I send it to the person who I have written it for. However, when I install it & run it on his PC it fails with SQL Server errors, and I guess that this is down to the fact that the program has a hard coded Connection in it that says "Data Source=MEDESKTOP;Initial Catalog=KAELC;Integrated Security=True" ... his PC is obviously not called MEDESKTOP, and I have no idea what the end user''s PC will be called ... How do I get around this problem ?!?

推荐答案

将连接存储在应用程序的配置文件中,并使用System.Configuration中的ConfigurationManager类读取它>组装. 此 [ ^ ]链接可能对您有用. Store your connection the application''s configuration file and read it using the ConfigurationManager class in the System.Configuration assembly. This[^] link might be of use to you.

更多推荐

发布VS2010项目以在其他PC上运行

本文发布于:2023-11-16 01:46:16,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1599883.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:项目   PC

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!