Click here to Skip to main content
15,900,907 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
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.
Posted
Comments
OriginalGriff 7-Mar-12 6:23am    
And what is your problem with this?
JawadHafiz 7-Mar-12 6:39am    
how to authenticate the credentials provided, in order to extract data from database for which login details provided.

1 solution

Create a SqlConnection.

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 the SqlConnection, 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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900