Click here to Skip to main content
15,888,579 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to connect remote sql server2012 from asp.net

getting error
System.Data.SqlClient.SqlException: Login failed for user


my connection string is
HTML
<add name="libacpConnectionString" connectionstring="Data Source=103.21.58.192;Initial Catalog=libacp;Persist Security Info=True;User ID=my id ;Password=my passowrd">
      providerName="System.Data.SqlClient" />


code is working ok on local server


pls help me out

[edit]Code block added - OriginalGriff[/edit]
Posted
Updated 20-Feb-15 21:53pm
v3

1 solution

The error message is pretty explicit: "Login failed for user"

That means one of three things:
1) You have the wrong IP address and the SQL instance doesn't know who you are.
2) You have the wrong User ID and the SQL instance doesn't know who you are.
3) You have the wrong Password and the SQL instance has rejected the log in request.

We can't fix any of those: you need to check your details and make sure that you are using the right information.
 
Share this answer
 
Comments
Member 8893861 21-Feb-15 4:16am    
Ok
But when i tried giving direct data source(servername, sql server authentication ) to grid view , and tested it my grid get populated

when i tried to catch the exception it show long error

may be i am doing a mistake in server name

actually my site is hosted on one server having sql (ip 1)
and i m connecting other hosting server with different slq (ip 2)

i have purchased space in both the places
OriginalGriff 21-Feb-15 4:24am    
"i have purchased space in both the places"
Doesn't mean that the same login details will work!
Member 8893861 21-Feb-15 5:35am    
yes definitely i am using different login details for both

My question is , can i login in from my asp project from one hosting to sql server
with different hosting (with its login details )
OriginalGriff 21-Feb-15 6:03am    
Yes - all you need is two different connections strings.
Member 8893861 21-Feb-15 6:21am    
Ok , could you help me find a solutions ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900