Solved

Trouble Opening SQL Server DB

Posted on 2013-05-14
7
387 Views
Last Modified: 2013-05-16
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
Comment
Question by:Bob Schneider
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 35

Assisted Solution

by:David Todd
David Todd earned 167 total points
ID: 39167609
Hi

Is database on autoclose?

What is exact error message?

Regards
  David
0
 
LVL 50

Assisted Solution

by:Vitor Montalvão
Vitor Montalvão earned 333 total points
ID: 39167612
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
 

Author Comment

by:Bob Schneider
ID: 39167646
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 50

Accepted Solution

by:
Vitor Montalvão earned 333 total points
ID: 39168073
Then check the sWhichSrvr value.
Anyway post the error.
0
 

Author Comment

by:Bob Schneider
ID: 39168854
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
 

Author Closing Comment

by:Bob Schneider
ID: 39170137
Now it is working, and my machine just underwent an upgrade...wierd.  Thank you.
0
 
LVL 50

Expert Comment

by:Vitor Montalvão
ID: 39170801
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

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question