Handling "Failed Connection to Datasource Error" in infopath using custom messages - InfoPath Dev
in

InfoPath Dev

Handling "Failed Connection to Datasource Error" in infopath using custom messages

Last post 05-13-2009 05:20 AM by GazM. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 05-12-2009 07:23 AM

    Handling "Failed Connection to Datasource Error" in infopath using custom messages

    Can anyone help me in handing Infopath sql exceptions before form Load.

    For example, if the datasource object or name is not available in data base,  before Form Load I am gettting the following error.

    Failed Connection to Datasource: 

    The query cannot be run for the following DataObject: EmployeeLookUp

    InfoPath cannot run the specified query.
    [0x80040E37][Microsoft OLE DB Provider for SQL Server] Invalid object name 'dbo.vw_EmployeeLookup'.

    Instead of getting the above error message, I want to handle it by using my custom Message.


     

  • 05-13-2009 05:20 AM In reply to

    • GazM
    • Top 200 Contributor
      Male
    • Joined on 11-09-2005
    • England
    • Posts 54

    Re: Handling "Failed Connection to Datasource Error" in infopath using custom messages

    Hi

    I use the following VB code to check to see if the Access DB is in use with a Form Load event. It checks for the existence of the lock file (.ldb) then displays a custom message if the DB is in use. I don't know SQL but I'm sure it should have something similar.

    Sub XDocument_OnLoad(eventObj)

    Dim db As String = ("pathname\access.ldb")

    'Check to see if database is in use

    If File.Exists(db) Then

    MsgBox("your message")

    Close()

    Else

    Open()

    End If

    End Sub

     

    Gary

Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.