根据提供的凭据从sql server 2008数据库中提取表. [英] extract tables from sql server 2008 database as per the credentials provided.
问题描述
我想构建一个Windows应用程序,其中我必须根据提供的凭据从sql server 2008数据库中提取表.
我想使用sql窗口,要求输入登录详细信息以访问数据库.
例如:
伺服器名称:12.11 .....
身份验证:sql server身份验证
用户名:sa111
密码:1234
服务器名称:62.10 .....
身份验证:sql server身份验证
用户名:saa111
密码:12345
..它应该向我提供所提供的Login凭证的表和存储过程.
i want to build a windows application where i have to extract tables from sql server 2008 database as per the credentials provided.
and I want to use sql window which asks for Login details to access database.
for example:
Server name: 12.11.....
Authentication: sql server authentication
username: sa111
password: 1234
Server name: 62.10.....
Authentication: sql server authentication
username: saa111
password: 12345
..it should provide me the tables and stored procedure of the credentials for Login in provided.
推荐答案
创建一个SqlConnection
.
有关此的更多信息: http://msdn.microsoft.com/en-us/library/9197xfyw.aspx [^ ]
为了获得相应的连接字符串:
http://www.connectionstrings.com/ [ ^ ]
http://www.connectionstrings.com/sql-server-2008 [ http://www.connectionstrings.com/sql-server-2005 [ GetSchema [
Create aSqlConnection
.
More on this: http://msdn.microsoft.com/en-us/library/9197xfyw.aspx[^]
In order to get the corresponding connection string:
http://www.connectionstrings.com/[^]
http://www.connectionstrings.com/sql-server-2008[^]
http://www.connectionstrings.com/sql-server-2005[^]
Given theSqlConnection
, you can use its methods both to execute queries, and to find out which schema objects exist. Particularly, take a look at GetSchema[^], a method that queries the database metadata for the presence of objects.
Hope this helps,
Pablo.
这篇关于根据提供的凭据从sql server 2008数据库中提取表.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!