Solved

Database failover question

Posted on 2004-09-24
5
195 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
  • 3
  • 2
5 Comments
 

Author Comment

by:Wonderflub
Comment Utility
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
Comment Utility
What error did you get ?
0
 

Author Comment

by:Wonderflub
Comment Utility
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
Comment Utility
OK then, nevermind... now it works, What did you do man?????
0
 
LVL 13

Expert Comment

by:Michael_D
Comment Utility
Funny!
Anyway thank you for points!

Good luck!
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now