Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

C# - ConnectString SQL SERVER

Status
Not open for further replies.

tedew1

Programmer
Oct 26, 2005
31
DE
hello,
I'm traying to connect with SQL SERVER , but I can't :(
after con.Open() I have :
Exception Details: System.Data.SqlClient.SqlException: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.

my ConnectionString looks :
Data Source=My_Server;Initial Catalog=Super_DB;Integrated Security=SSPI;Trusted_Connection=Yes"

I have no idea , what is wrong
:(
???

bye,
sorry for my english

 
tedew1,

You are using integrated security (network user) and the user is not in the Sql Server and possible the DB. If you add username and password then it might be more straight forward. Otherwise make sure the user that is logged in is allowed to access the SQL Server and the DB. Note: this may include ASP built in account or IIS built in account

See
 
hello,
thx for your replay:)
this connectString works under WinXp when I'm login to the domian. When I'm login under Win2003 Serv as Local Administrator dosen't work :(

 
Local users are not members of the domain, and so integrated security (which relies on domain resources to authenticate you) won't work.

Chip H.


____________________________________________________________________
Donate to Katrina relief:
If you want to get the best response to a question, please read FAQ222-2244 first
 
ok,

And what user is default to login to SQl Server ???
I,m traing this:

"Data Source=My_Server;Initial Catalog=Super_DB;User Id=sa;Password=;"
I think user "sa" dosen't have a password , but I'm not sure.

but this ConnectString dosen,t work :(
still is Null-user :(
bye
 
hi,

To connect to SQL server I use the following string:

server=<host>\\<server_name>;Pooling=False;Trusted_Connection=false;database=<database_name>;User ID=<username>;Password=<password>;

where...

<host> is your host machine
<server_name> is the name of your SQL Server
(Pooling=False) this gets round a bug in early versions of SQL server about pooling connnections
(Trusted_Connection=false) if you are not using Windows Authentication
<database_name> the name of your database
<username> the name of the user
<password> your password

I would also recommend creating a password for the user.

Cheers
Steve
 
Always a handy addition to your Favorites...
ConnectionStrings.Com

Rhys
Gene Roddenberry was a legendary pioneer of thought-provoking, futuristic science fiction. George Lucas created Jar Jar Binks
 
hello:)
I have another quastion:)
I have 3 computers:
Computer A ( Client XP )
Computer B ( win 2003 Server + IIS + my C# webapp )
Computer C ( win 2003 Server + SQL SERVER )

comunication :
A -> b -> c

I am login on the Compueter A ( to domain ) and run the Internet Expolrer , then I connect to the Computer B and Computer B try connect to the Computer C .
Is it possible that in all this communication will be use windows authentication ??? all the computers are in the same domain - but computer B and C are always log off

bye,
 
tedew1 - since this is not really related to the original question, you should start another thread.

Chip H.


____________________________________________________________________
Donate to Katrina relief:
If you want to get the best response to a question, please read FAQ222-2244 first
 
@chiph
OK , I will do it :) in the appropriate place

bye nad thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top