0

I change some field from char(50) to be VARCHAR(MAX). I did this change from the visual studio.

Now, i trying to access to the database and i get the exception

Cannot open user default database. Login failed. Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.

my knowledge on sql is very pure - and i dont know how to solve this problem.

I used this - and still nothing work fine.

Thanks for any help.

Update: I reverse the change that i made thru the visual studio - and all work fine. I made the change in same way and the exception appear again.

Is there some other way to do this simple change ?

Community
  • 1
  • 1
Yanshof
  • 9,659
  • 21
  • 95
  • 195
  • Are you connecting to SQL from a web app? – Mark PM Jun 22 '11 at 10:50
  • It's a bit of a guess but I doubt the two are connected. What application/process is causing the login failure. Is it your application or Sql Server Management Studio for example? – MrEdmundo Jun 22 '11 at 10:50
  • OK , So i developing WCF server application. When i run the server i get the exception ( only on runtime ). – Yanshof Jun 22 '11 at 10:54
  • I using Linq to SQL to make my sql read/write. this is something that work fine before my field change ( char(50) to be VARCHAR(MAX)) and i did not change anything beside this. – Yanshof Jun 22 '11 at 10:55
  • 1
    ALTER TABLE xyz ALTER COLUMN abc VARCHAR(MAX) BUT this shouldn't affect the connection to the database – Mark PM Jun 22 '11 at 15:41

1 Answers1

1

Basically because your WCF server app runs under the network service account it cannot use windows authentication to connect to SQL. Can you not use SQL username and password as the connection string?

Mark PM
  • 2,909
  • 14
  • 19
  • Im not using username & password on my connection string. I have simple .mdf file that i connect with - and i just using the linq to get the data ( read / write ). – Yanshof Jun 22 '11 at 11:17