Click here to Skip to main content
14,971,754 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
hi i got a bit of a strange problem. i have an aspx page where my dropdown connects to the database to populate the dropdown box.
this works fine but when i run my insert command i get login failed for user ' ' not associated with a trusted SQL server connection. both use the same connection details.

Dim connections As String = "Server=INTR\SQLEXPRESS;Initial Catalog=CREDIT_REJECT;Persist Security Info=True;User ID=sa;Password=HoyaHill11;"
        Dim mycon As New SqlConnection(connections)


i have checked and the sa user is sysadmin so it should have write permissions.
i am not sure what else to check as this is very confusing. any assistance will be appreciated
Ahmed Bensaid 6-Jun-13 5:49am
We need some more details in order to help you.
Where is the code which works fine ? What is the raised exception message ?
Maciej Los 6-Jun-13 11:59am
Does your sql server enables remote connections?
Does your sql server is installed on machine with static ip?
To connect with SQL server from WWW, you need to define ip address for ms sql server, not a name!

Try to connect your SQL server using Visual studio inbuilt server explorer. If its connected, then copy that connection string (using its property) and use it in your code.

RedDk 11-Jun-13 12:58pm
This is always a good idea. And in general, using other tools in a way similar to how one uses the primary tool can only reinforce the basic priniciple.
Just Try "integrated security=true" instead of Username & Password

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