共享SQL数据库连接字符串 [英] Share SQL Database Connection String

查看:127
本文介绍了共享SQL数据库连接字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的项目中添加一个对我的项目是全局的文件(数据库连接文件).因此,如果我对该文件中的连接字符串进行更改,则更改将影响使用该连接字符串的所有代码.

C#(Visual Studio 2008)中是否存在共享连接字符串的预定义方法?

oyu可以一步一步告诉plez
m在c#.net中的新功能

这是基于窗口的应用程序

请以正确的方式告诉它紧急的

I want to add a file in my project that is global to my project (database connection file). So, if I make a change to the connection string in that file, the change will affect all code that uses that connection string.

Is there a predefined method of sharing a connection string in C# (Visual Studio 2008)?

can oyu tell step by step plez
m new in c#.net

this is window based application

plez tell in proper way its urgent

推荐答案

将连接字符串存储在您的
Store the connection string in your project settings.

What I like to do is store several connection strhings in the project settings, then have another setting that indicates which of those settings to pick from. Makes debugging easier, as you can switch connection strings without having to store them somewhere else.


首先,您需要指出是否正在使用Windows Forms(最有可能),ASP .net(可能性较小)或WPF(可能性最小).其次,我发送给您的链接向您展示了如何使用设置... 逐步.阅读.
First of all, you need to indicate if you are working with Windows Forms (most likely), ASP.net (less likely), or WPF (least likely). Second of all, that link I sent you shows you how to use settings... step by step. Read it.


这篇关于共享SQL数据库连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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