How can test the pw for Sql Server 2000

  • Thread starter Thread starter ad
  • Start date Start date
A

ad

I want a user input the password of sa of Sql Server 2000.

How can I test if the password is correct?
 
ad said:
I want a user input the password of sa of Sql Server 2000.

How can I test if the password is correct?

Get the user to type the password into a TextBox
Postback
Build up a ConnectionString including the contents of the TextBox
Instantiate an ADO.NET Connection object using the ConnectionString
Try to open the Connection and trap for any SQL Server errors
 
try to connect to SQL Server. If you are able to connect, the password is
correct.

Some apps don't try to connect. In those apps, they usually ask the user to
enter the password twice, and then they store the password encrypted until
it is needed.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
 
I actually chuckled aloud at that!! :-)

I guess a person could catch the SqlException and see what it says for a
known bad password - and then handle it that way. But also handle it
appropriately if the server isn't found, the name can't be resolved or if
the wrong provider is specified, etc..
 
Back
Top