如何使用动态连接字符串连接DB [英] How to use dynamic connection string to connect DB

查看:122
本文介绍了如何使用动态连接字符串连接DB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我创建了动态连接字符串,它成功存储了web,配置文件,但我的问题是



1)如何使用连接字符串连接数据库



2)哪种方式最适合动态连接字符串到存储数据库或web配置文件...



谢谢..

Hi,

I created dynamic connection string and it stored web,config file successfully but my problem is

1) how to use the connection string to connect DB

2) Which way is best for dynamic connectionstring to stored database or web config file...

Thanks ..

推荐答案

广告1)

如何:从Web.config文件中读取连接字符串 [ ^ ]



广告2)

这取决于您的需求。基本上,如果将连接字符串集合存储在数据库中,则需要为此数据库定义连接字符串(使用webconfig文件)以连接到该数据库并获取其他连接字符串。结论:webconfig文件。
Ad 1)
How to: Read Connection Strings from the Web.config File[^]

Ad 2)
It depends on your needs. Basicaly, if you store the collection of connection-strings in a database, you need to define a connection string to this database (using webconfig file) to connect to it and fetch other connection-strings. Conclusion: webconfig file.


这篇关于如何使用动态连接字符串连接DB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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