Showing posts with label password. Show all posts
Showing posts with label password. Show all posts

Friday, March 30, 2012

how can i connect with lank password

hi all
i setup my sqlserver2000 on win 2000 and let him to take username and password from windows
so how can i connect to it with blank uid,pwd?
thanxYou can use trusted connection as :
"Server=Aron1;Database=pubs;Trusted_Connection=True;"

FYI: http://www.connectionstrings.com

Regards,|||thanx alot|||hello aain
i tried to connect but an eror msg appears:
Exception Occurred: Login failed for user 'COMPU-DSW51C8DZ\ASPNET'.

i'm using this code:

SqlConnection cn;
SqlCommand cm;
String strSQL;

cn = new SqlConnection ("server=localhost;database=Northwind;Trusted_Connection=true;");
strSQL = "INSERT INTO Employees " +
"(EmployeeID,FirstName,LastName,City) " +
"VALUES ('" + txtID.Text + "', '" +
txtFirstName.Text + "', '" +
txtLastName.Text + "', '" +
ChkToInt(chkCity) + "')";

cm = new SqlCommand(strSQL, cn);

// ** Open connection
try
{
cn.Open();
// ** Execute command
cm.ExecuteNonQuery();
}
catch(SqlException sx)
{
Response.Write("Exception Occurred: " + sx.Message);
}
finally
{
if (cn.State == ConnectionState.Open)
cn.Close();
}|||This means you need to set up COMPU-DSW51C8DZ\ASPNET as a login in SQL Server.

Do you have Query Analyzer? Running this will create the login:

exec sp_grantlogin 'COMPU-DSW51C8DZ\ASPNET'

And running this will give permission to the database:
exec sp_grantdbaccess 'COMPU-DSW51C8DZ\ASPNET'

Make sure that northwind is the current database before running executing sp_grantdbaccess.

Terri

Wednesday, March 28, 2012

How can I change the login name and password?

How can I change the login name and password? Quite frankly, I would like the
login name to be same as my WIndows login and no passwrod.
Syntax
sp_password [ [ @.old = ] 'old_password' , ]
{ [ @.new =] 'new_password' }
[ , [ @.loginame = ] 'login' ]
HTH, Jens Suessmeyer.
"Marty" <Marty@.discussions.microsoft.com> schrieb im Newsbeitrag
news:9BA17C7E-07B5-43DE-BADF-F15AA921DF52@.microsoft.com...
> How can I change the login name and password? Quite frankly, I would like
> the
> login name to be same as my WIndows login and no passwrod.
|||I typed exactly what you wrote, except for the brackets, at a command prompt.
I got the error message that sp_password is not a recognized command. Is
there a particular folder I have to be in for this to work? If I want to
leave the password blank do I just not enter nothing or do I use the word
null.
Thanks for your help
"Jens Sü?meyer" wrote:

> Syntax
> sp_password [ [ @.old = ] 'old_password' , ]
> { [ @.new =] 'new_password' }
> [ , [ @.loginame = ] 'login' ]
>
> HTH, Jens Suessmeyer.
> "Marty" <Marty@.discussions.microsoft.com> schrieb im Newsbeitrag
> news:9BA17C7E-07B5-43DE-BADF-F15AA921DF52@.microsoft.com...
>
>
|||master..sp_password 'myoldone','mynewone','theusername'
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
"Marty" <Marty@.discussions.microsoft.com> schrieb im Newsbeitrag
news:0B925CDD-32D6-49A1-B132-75C56007289B@.microsoft.com...[vbcol=seagreen]
>I typed exactly what you wrote, except for the brackets, at a command
>prompt.
> I got the error message that sp_password is not a recognized command. Is
> there a particular folder I have to be in for this to work? If I want to
> leave the password blank do I just not enter nothing or do I use the word
> null.
> Thanks for your help
> "Jens Smeyer" wrote:
|||sp_password still comes up as an invalid command. In your second example you
omitted @.old, etc. Please give me the exact syntax and command.
Thanks again
"Jens Sü?meyer" wrote:

> master..sp_password 'myoldone','mynewone','theusername'
> HTH, Jens Suessmeyer.
> --
> http://www.sqlserver2005.de
> --
> "Marty" <Marty@.discussions.microsoft.com> schrieb im Newsbeitrag
> news:0B925CDD-32D6-49A1-B132-75C56007289B@.microsoft.com...
>
>
|||My first post was the common expression based on BOL Syntax.
Where do you fire the commadn to the SQL Server, from OSQL ?
Jens Suessmeyer.
"Marty" <Marty@.discussions.microsoft.com> schrieb im Newsbeitrag
news:11D32945-2151-4EFE-9608-CCEA419BDE07@.microsoft.com...[vbcol=seagreen]
> sp_password still comes up as an invalid command. In your second example
> you
> omitted @.old, etc. Please give me the exact syntax and command.
> Thanks again
> "Jens Smeyer" wrote:
|||Sorry but I don't know what BOL means. OSQL? I typed the command from a
command promt. I thought I was in the wrong folder so I did a search of the
entire drive for the command sp_password and couldn't find it.
Sorry to be such a pest. I really appreciate you sticking with me.
Marty
"Jens Sü?meyer" wrote:

> My first post was the common expression based on BOL Syntax.
> Where do you fire the commadn to the SQL Server, from OSQL ?
> Jens Suessmeyer.
> "Marty" <Marty@.discussions.microsoft.com> schrieb im Newsbeitrag
> news:11D32945-2151-4EFE-9608-CCEA419BDE07@.microsoft.com...
>
>
|||-BOL (Books Online) Help for SQL Server included in the installing package.
-OSQL Commandline Uitl to query the SQl Server.
Start --> Run --> Cmd --> Then the command i send to you. here you can
execute the sp_chanegpassword command.
Further information, just raise a hand, you are not bothering me :-)
HTH, Jens Suessmeyer.
"Marty" <Marty@.discussions.microsoft.com> schrieb im Newsbeitrag
news:7B1AAD94-C5A0-4782-8BA6-2B1F6DC95E5E@.microsoft.com...[vbcol=seagreen]
> Sorry but I don't know what BOL means. OSQL? I typed the command from a
> command promt. I thought I was in the wrong folder so I did a search of
> the
> entire drive for the command sp_password and couldn't find it.
> Sorry to be such a pest. I really appreciate you sticking with me.
> Marty
> "Jens Smeyer" wrote:
|||I'm afraid I'm still lost. What folder to I have to be in when I execute the
command line? I have tried the command line at a command promt and get the
message that it is an unreconizeable command. Am I dumber than I thought?
"Jens Sü?meyer" wrote:

> -BOL (Books Online) Help for SQL Server included in the installing package.
> -OSQL Commandline Uitl to query the SQl Server.
> Start --> Run --> Cmd --> Then the command i send to you. here you can
> execute the sp_chanegpassword command.
> Further information, just raise a hand, you are not bothering me :-)
> HTH, Jens Suessmeyer.
> "Marty" <Marty@.discussions.microsoft.com> schrieb im Newsbeitrag
> news:7B1AAD94-C5A0-4782-8BA6-2B1F6DC95E5E@.microsoft.com...
>
>
|||By the way, I found the article and the syntax is exactly what you said it
was. But I still get the error
"Jens Sü?meyer" wrote:

> -BOL (Books Online) Help for SQL Server included in the installing package.
> -OSQL Commandline Uitl to query the SQl Server.
> Start --> Run --> Cmd --> Then the command i send to you. here you can
> execute the sp_chanegpassword command.
> Further information, just raise a hand, you are not bothering me :-)
> HTH, Jens Suessmeyer.
> "Marty" <Marty@.discussions.microsoft.com> schrieb im Newsbeitrag
> news:7B1AAD94-C5A0-4782-8BA6-2B1F6DC95E5E@.microsoft.com...
>
>

Monday, March 26, 2012

How can I change password of SQLServer2005/Expres ?

ow can I change password of SQLServer2005/Expres ?You mean the sa password? You can change it using Management Studio and goign to edit the login.

Monday, March 19, 2012

How can a user change password in SQL2005 via TSQL?

I have an application that controls user logins, passwords, etc. at the front end for a SQL database. I am in the stage of migrating to SQL2005 and cannot get the TSQL code to allow a user to change their own password. Here's the background;

The ADMIN of the app is a Sysadmin on the SQL server and can create logins, set roles, etc. Assume the Admin creates a user TOM with a password of xxxx. This works fine using the create login statement from a Connect.Execute statement from my app like so;

"Create Login 'TOM' With Password 'xxxx', Default_Database = 'myDB', Check_Policy = OFF"

TOM will be setup with db roles as well

When TOM logins into my app, he will have to change his password at some point. The TSQL code I am using (which fails) is executed by TOM who has a connection to the SQL db because he is logged into the app.

"Alter Login TOM With Password = 'xxxx' Old_Password = 'xxxxx', Check_Policy = OFF"

At this point I get an error:

RunTime error -2147217900 (80040e14)

ODBC SQL Server Driver][SQL Server] Cannot alter

the login 'TOM', becuase it does not exist or you do

not have permission.

Obviously it exists since TOM is currently logged into the SQL Server. So if it's permissions related, what permissions does a user need to change his/her password? Or is there another way to do it?

Thanks in advance for your help.

CH

A user does not need any permissions to change his password, but he cannot change his password policy setting - that option is only settable by someone that has ALTER ANY LOGIN permission. See http://msdn2.microsoft.com/en-us/library/ms189828.aspx.

Thanks

Laurentiu

|||

If I have the users change password statement read; it works.

"Alter Login TOM With Password = 'xxxx' Old_Password = 'xxxxx' "

However, I am unable to test this on a Win2003 Server right now, so I wonder if the Check Policy will be enforced for user TOM.

Under no circumstances do I want to have Policy Checked since the front end of my app provides the password security.

Any ideas if this is possible?

CH

|||If you are using ADO.NET 2.0 you can also use the

SqlConnection.ChangePassword(ConnectionString, "MyNewSecretpassword");

For changing the password.

Jens K. Suessmeyer.

http://www.sqlserver2005.de
|||

Thanks for the reply.

The problem we have run into is the Windows security, which is set across the domain, maybe set differently than our app. So if the user of our app chooses a different policy that that of the domain (which is fine), the user cannot alter his login since he does not have Alter Any login rights. And we wouldn't want to give him any.

Do you see a way around this?

All I can think of now is to change the password via the Admin login through a separate connection to the database. Something like this;

Dim gConnTmp As New ADODB.Connection
Dim sConnect As String

With gConnTmp
sConnect = "DSN=" & SQLDataSource & ";"
sConnect = sConnect & "UID= 'ADMIN' ;"
sConnect = sConnect & "PWD=" & gsPassword & ";"
.Open sConnect
End With

'change the password here... ALTER LOGIN etc.

'kill connection

gConnTmp.Close
Set gConnTmp = Nothing

Do you see any issues with doing this? I think it looks ok.

CH

|||

If you want to enforce a custom password policy, then you should just create the login with CHECK_POLICY set to off; otherwise, the Windows password policy will be enforced for a password change (on Windows 2003).

Thanks

Laurentiu