Solved

Database failover question

Posted on 2004-09-24
5
234 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

Industry Leaders: 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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month6 days, 15 hours left to enroll

623 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