远程获取用户数据库连接字符串 [英] remotely getting the users database connection string

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

问题描述


我正在将asp.net 2.0与c#和sql服务器一起使用.

当用户登录到我的网站时,我想访问用户的本地数据库,所有用户都具有相同的数据库名称,每件事都具有相同的表,但它们未连接到网络中.
所以我想知道如何在该用户的连接字符串中获取数据源值,以便可以访问他的本地数据库.

你能举个例子对我有帮助吗?

Hi,
I am using asp.net 2.0 with c# & sql server.

when user logins to my website i want to access the users local database, all user having the same database name, same tables every thing but they are not connected in network.
so i want to know how to get the data source value in the connection string for that user, so that i can acess his local database.

can you give example which helps me

推荐答案

好吧,当像databse这样的表,表scehma都一样时.当数据库不在网络上并且仅在本地访问时,则无需进行大量编码.

只需在连接字符串(预定义)的数据源中使用." (点)或"localhost" 即可!应该可以.
Well, when eveything like databse, table scehma are same. When the database is not on network and only accessed locally, then you dont have to do much of a coding.

Just use "." (a dot) OR "localhost" in the datasource of the connection string (pre-defined)! That should do.


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

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