如何在运行时更改Db连接字符串? [英] How to change Db connection string at runtime ?

查看:84
本文介绍了如何在运行时更改Db连接字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 


我有以下情况。


 我已经开发了一个  Light switch 应用程序(桌面客户端)为我们拥有的所有表创建一个新视图。使用此视图我可以输入和CRUD数据。作为顾问,我将在客户所在地检查他们的DB(我们的产品),
意味着他们将具有与我用于创建Lightswitch应用程序的DB相同的结构。现在我的问题是如何更改Connectionstring以便我的应用程序将与他们的DB(运行时)通信? 


我已经尝试使用服务器生成的代码下的Web.config使我的VS崩溃! 


任何答案/想法都值得赞赏! 


// Kumar 


 


S.Kumar

解决方案

我在服务器生成的代码下尝试使用Web.config这让我的VS崩溃了! 

您好Kumar,


感谢您对LightSwitch的关注。我很想知道配置文件中的哪些更改导致崩溃。


您可以更新连接字符串以指向正确的数据源。首先,发布应用程序。发布成功后,在"发布"子文件夹中将出现"install.htm"。此文件中的一条说明是关于设置连接
字符串。如果它不起作用,请尝试让我知道。


 


谢谢,


Ravi


Hi 

I have the following scenario.

 I have developed a Light switch application (desktop client) which create a new view for all the table we have, Using this view I can input and CRUD data . Being a consultant I will be at customers place to check their DB (our product) which means they will have the same structure of the DB which I used to create the Lightswitch App. Now My question is how to change the Connectionstring so that my app will talk to thier DB (Runtime)? 

I have tried with Web.config under server Generated code which made my VS to crash ! 

Any answers / ideas are appreciated ! 

// Kumar 

 


S.Kumar

解决方案

I have tried with Web.config under server Generated code which made my VS to crash ! 

Hi Kumar,

Thanks for your interest in LightSwitch. I would be interested to know what changes in the config file lead to the crash.

You can update the connection string to point to the correct datasource. First, publish the application. After publish succeeds, in 'Publish' subfolder there will be 'install.htm'. One of the instructions in this file is about setting the connection string. Please try and let me know if it does not work.

 

Thanks,

Ravi


这篇关于如何在运行时更改Db连接字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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