Solved

Database failover question

Posted on 2004-09-24
5
230 Views
Last Modified: 2013-12-25
ok, so I have a database that is intrinsical to my program, the first thing I do when my program runs is open the database, if the database does not open, I try the next database, if that doesnt work, the program terminates.  Here is my code

Public Function Open_Database(ByVal strDatabase As String) As ADODB.Connection

Dim ConnectionString1 As String
Dim ConnectionString2 As String
Dim MyConnection As ADODB.Connection

On Error Resume Next

Set MyConnection = New ADODB.Connection

ConnectionString1 = "Driver={SQL Server};User=???;Password=?/?????;Server=???????;Database=" & strDatabase & ";"
ConnectionString2 = "Driver={SQL Server};User=?????;Password=???????;Server=???????;Database=" & strDatabase & ";"


MyConnection.Open ConnectionString1

If Err.Number <> 0 Then

    MyConnection.Open ConnectionString2
   
    If Err.Number <> 0 Then
        MsgBox "There was an error opening the " & strDatabase & " Database. Program cannot log and will terminate. Please investigate immediately!"
        Shell "C:\Terminate.exe", vbHide
    End If

WHen I run my program, I get the error message I stipulated.  I have checked the user name Spellings (all correct), the pwd spellings (again all correct) and the server connection(works)
0
Comment
Question by:Wonderflub
[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
  • 2
5 Comments
 

Author Comment

by:Wonderflub
ID: 12148604
Ok, so when I run my program from the VB devel environment, and not formteh compiled DLL.... I can connect to the intial to write a flag, but when it tries to log ot the log database, a white box that looks abotu the sixe of the project test form, opens up in teh corner with nothing in it, and the program freezes... ANY suggestions, this is uber strange....
0
 
LVL 13

Accepted Solution

by:
Michael_D earned 500 total points
ID: 12148665
What error did you get ?
0
 

Author Comment

by:Wonderflub
ID: 12148695
well, when I ran it from the compiled DLL I get the error that I stipulate in my msgbox.... cannot gconnect, program will terminate.

WHen I run it in VB6 environment, I get no error, it connects to the first database fine, XnetSQL on the server, but when it tries to connect to the log database to log the errors, I get a white box wigh nothing in it, and the program freezes.  I don't even have a graphical interface for the box to appear....

So I just checked the database, and it is logging the errors, they are there from teh VB test enviro runs, but the program never finished, it just had the silly white box....

Ok, so if it can log and connect when in the VB enviro why not from the compiled DLL????
0
 

Author Comment

by:Wonderflub
ID: 12148699
OK then, nevermind... now it works, What did you do man?????
0
 
LVL 13

Expert Comment

by:Michael_D
ID: 12149097
Funny!
Anyway thank you for points!

Good luck!
0

Featured Post

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!

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

710 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