Friday, February 24, 2012

Connection String in ASP.NEt

Hi

I'm using VB.NET in ASP.NET .

Windows 2000

Visual Studio 2005

and SQLServer 2005.

I'm new to VS 2005

I'm using the following code for connection

<

addkey="dsnstring"value="persist Security info=False; User ID=; password=;Initial Catalog=TransMate1; Data Source=Localhost trusted_connection=yes" />

it is giving the error as 'Cann't do the connection since user id cann't be null

It is not exact words of the error message.

following code is working fine with the SQL Server 2003 but not with SQL Server 2005.

<add key="dsnstring" value="persist Security info=False; User ID=sa; password=dreams;Initial Catalog=TransMate; Data Source=Localhost" />

Kindly help me

Thanks in advance

Regards.

If you use Trusted_Connection=yes that is, Windows Authentication, do not have userid or password in the connection string since they are dealed by the Windows authentication. You don't provide them in that case.

<add key="dsnstring" value="Initial Catalog=TransMate1; Data Source=Localhost;trusted_connection=yes" />

No comments:

Post a Comment