Solved

Database failover question

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
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…

929 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

10 Experts available now in Live!

Get 1:1 Help Now