Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 401
  • Last Modified:

Trouble Opening SQL Server DB

I have a vb6 app that uses a sql server express database.  Suddenly I am having difficulty opening it.  Here is what I use to open the db:

    sWhichSrvr = lstWhichComp.Text
    
    Call Hourglass
    
    Set conn = New ADODB.Connection
    
    If sWhichSrvr = "Remote" Then
        conn.Open "Provider=SQLNCLI10;Server=216.185.199.1,1433\SQLExpress;Database=VIRA;Uid=xxx;Pwd=xxx;"
    Else
        conn.Open "Provider=SQLNCLI10;Server=" & sWhichSrvr & "\SQLExpress;Database=VIRA;Trusted_Connection=yes;"
    End If

Open in new window


Now I get an error when I try to access the db.  What might cause that to change?  Antivirus?  Malware?  I don't think I have added any of that since last use.

Thanks so much!!
0
Bob Schneider
Asked:
Bob Schneider
  • 3
  • 3
3 Solutions
 
David ToddSenior DBACommented:
Hi

Is database on autoclose?

What is exact error message?

Regards
  David
0
 
Vitor MontalvãoMSSQL Senior EngineerCommented:
It would help if you post the error but by the code if have doubts if the line for the remote connection is correct (you shouldn't need the TCP port when you give the instance name).
Try this one:
   If sWhichSrvr = "Remote" Then
        conn.Open "Provider=SQLNCLI10;Server=216.185.199.1\SQLExpress;Database=VIRA;Uid=xxx;Pwd=xxx;"
    Else
        conn.Open "Provider=SQLNCLI10;Server=" & sWhichSrvr & "\SQLExpress;Database=VIRA;Trusted_Connection=yes;"
    End If 

Open in new window

0
 
Bob SchneiderCo-OwnerAuthor Commented:
I will post the error code and look at the remote cinnection but it is the lcal connection i am hing trouble with...and it worked until just recently
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Vitor MontalvãoMSSQL Senior EngineerCommented:
Then check the sWhichSrvr value.
Anyway post the error.
0
 
Bob SchneiderCo-OwnerAuthor Commented:
I am not near my desk and I will post it when I get home but the gist of it is that it can't find the database.  Lets not forget that IT HAS WORKED WELL UNTIL RECENTLY (all caps for emphasis, not for anger :) ).  The db is in the same place.  My concern is what would cause it to suddenly stop working.  Hmmmm.....
0
 
Bob SchneiderCo-OwnerAuthor Commented:
Now it is working, and my machine just underwent an upgrade...wierd.  Thank you.
0
 
Vitor MontalvãoMSSQL Senior EngineerCommented:
If it happens again, please send the error. There should be something in the error message that can lead us to the problem.

Cheers
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now