locked
sql connection not established - stalls RRS feed

  • Question

  •  
     Private connectionObj As SqlConnection 
     Private commandObj As SqlCommand 
     connectionString = "Data Source=xxx.xxx.xx.xxx;Initial Catalog=database;Password = password; User Id=app_user; Persist Security Info =true" 
     
        commandObj = New SqlCommand 
        connectionObj = New SqlConnection 
     
        connectionObj.ConnectionString = connectionString 
        commandObj.Connection = connectionObj 
        commandObj.CommandType = CommandType.StoredProcedure 
        connectionObj.Open() 
    
    

    I have never encountered this issue but for some reason when declaring a new sqlconnection, it stalls. I have set up everything as I usually do and cannot figure out what is wrong. Appreciate any responses.

    vendredi 5 novembre 2010 15:16

Réponses

  • Can you connect to SQL Server from that computer without using your application? That is, try something else such as sqlcmd to determine if the problem is in your code, or inherent in connecting to SQL Server. This could be anything, such as SQL Server not running. Since you wrote xxx.xxx.xx.xxx are connecting by using an IP address to a default instance listening on TCP port 1433?
    Rick Byham, Microsoft, SQL Server Books Online, Implies no warranty
    • Marqué comme réponse faafa vendredi 5 novembre 2010 16:51
    vendredi 5 novembre 2010 15:40
    Auteur de réponse

Toutes les réponses

  • Can you connect to SQL Server from that computer without using your application? That is, try something else such as sqlcmd to determine if the problem is in your code, or inherent in connecting to SQL Server. This could be anything, such as SQL Server not running. Since you wrote xxx.xxx.xx.xxx are connecting by using an IP address to a default instance listening on TCP port 1433?
    Rick Byham, Microsoft, SQL Server Books Online, Implies no warranty
    • Marqué comme réponse faafa vendredi 5 novembre 2010 16:51
    vendredi 5 novembre 2010 15:40
    Auteur de réponse
  • I tried that and no I cannot connect. I opened sql configuration manager to see if the services were running, restarted them and still cannot connect. I cant even open SSMS to connect to my local desktop server.
    vendredi 5 novembre 2010 16:17
  • nevermind, I closed everything and restarted my machine and now everything seems  fine. thanks
    vendredi 5 novembre 2010 16:50