Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 SQL Password Prerequisites

Author  Topic 

t.summerfield
Starting Member

7 Posts

Posted - 2007-03-28 : 05:23:19
I have a script which creates a new user. I also have a webpage which uses the DB for various reasons. In the DB config file I use the following to connect to the DB;

<ConnectionString>User Id=<username>;Password=<pword>; DataBase=<DBname>; Server = <servername>;</ConnectionString>

For the username and password I use the newly created user information but I can’t connect. However if I use “sa” to login I have no problem. Is this a case of some crappy SQL prerequisites?? i.e. automatically checking “Enforce password expiration” or “user must change password at next login” in the user properties. If I change the password for the new user in properties I can connect no problem.

Is there a way around this, so I don’t have to change the password before I can connect to the DB?

Thanks in advance

Regards
Toby

t.summerfield
Starting Member

7 Posts

Posted - 2007-03-28 : 06:20:04
The script I am using is as follows;

if not exists (select * from dbo.sysusers where name = N'User' and uid < 16382)
EXEC sp_grantdbaccess N'User', N'User'
GO
Go to Top of Page
   

- Advertisement -