Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Databases Basics
|
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 11th, 2006, 01:32 PM
Registered User
 
Join Date: Dec 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Logon Form to Oracle quit working

I have several applications that connect to Oracle. However, I haven't used them very often. But all of a sudden, they all seem to have stopped working. I am getting a TNSNames error, could not resolve service name error.

If this was a new application, I would think that my app was broken. However, these have worked up until the last few months. I know that the database/TNSNames works, because I use TOAD with several databases all the time. There is only one tnsnames.ora on my PC. I had the Microsoft Access Objects 2.8 in my project, but I backed up to 2.6 for something to try. No change. I am connected to the database now, so I know the database itself is up. TNSPING to the server gets an OK back.

I am stuck, I am hoping that someone has a suggestion of what to try or check. There haven't been any changes to the app or the Oracle setup lately that I know....could MS have changed something (a patch?) that might have screwed up my connection?

TIA,

DJM


Code from form:

Option Explicit
Public OraSession As OraSession
Public connect As String

Public Sub cmd_Click(Index As Integer)

If Index = 0 Then
        connect = txtField(0) + "/" + txtField(1)
        sUserID = txtField(0)
        sDatabase = txtField(2)
        GoTo ErrorHandler
Else
    If Index = 1 Then
        End
    End If
End If
ErrorHandler:


        If OraSession.LastServerErr = 0 Then
            If Err = 0 Then

            '
                'MsgBox ("connected.") ' as " & Connect)
                Set OraSession = CreateObject("OracleInProcServer.xorasession")
                Set OraDatabase = OraSession.OpenDatabase(txtField(2), connect, 0&)
                sDatabase = txtField(2)
                Me.Hide
                Unload Me
                Reset_Menu
                frmMain.Show
            Else
                MsgBox ("VB=" & Err & " " & Error)
            End If
        Else
            MsgBox (OraSession.LastServerErrText)
        End If

End Sub

Public Sub Form_Load()
    Set OraSession = CreateObject("Oracleinprocserver.xorasession")
    cmd(0).Enabled = False
    'txtField(2).text = "PROD"
End Sub

Private Sub Form_Unload(Cancel As Integer)
    frmMain.Show
End Sub

Public Sub lblField_Click(Index As Integer)
    Select Case Index
        Case 0
            If (txtField(0) <> "") And (txtField(1) <> "") And (txtField(2) <> "") Then
                cmd(0).Enabled = True
                cmd(2).Enabled = True
            End If
        Case 1
        Case 2
    End Select
End Sub

Public Sub txtField_GotFocus(Index As Integer)
    txtField(Index).SelStart = 0
    txtField(Index).SelLength = Len(txtField(Index))
End Sub

Private Sub txtField_LostFocus(Index As Integer)
    If Len(Trim(txtField(0))) > 0 And Len(Trim(txtField(1))) > 0 And Len(Trim(txtField(2))) > 0 Then
        cmd_Click (0)
    End If
End Sub

Public Sub txtField_Validate(Index As Integer, Cancel As Boolean)
    If (txtField(0) <> "") And (txtField(1) <> "") And (txtField(2) <> "") Then
        cmd(0).Enabled = True
    End If
End Sub





Similar Threads
Thread Thread Starter Forum Replies Last Post
Form quit and Access debor19071 Access VBA 1 March 3rd, 2008 09:51 AM
Conditional formatting quit working in access 2003 Dragonlight Access 1 March 16th, 2007 07:07 AM
Excel does not quit vemaju Access VBA 0 February 23rd, 2005 02:26 PM
Excel does not quit vemaju Excel VBA 4 February 22nd, 2005 06:40 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.