database connection problem in VB.net - InfoPath Dev
in

InfoPath Dev

database connection problem in VB.net

Last post 07-12-2005 11:52 PM by Agni Jonnalagadda. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 07-12-2005 04:16 PM

    • GerEielts
    • Not Ranked
    • Joined on 07-12-2005
    • Netherlands
    • Posts 1

    database connection problem in VB.net

    Hi all,

    When I open an infopathproject in Visual Studio and want to add some code to a button on a InfoPath-form, like this:

    Public Sub CTRL11_5_OnClick(ByVal e As DocActionEvent)
    Dim ConnectionString As String =
    "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\Ontwikkel\G\Ger\Nummers.mdb;"
    Dim Conn1 As OleDbConnection = New
    OleDbConnection(ConnectionString)
    Dim Comm1 As OleDbCommand = New OleDbCommand("UPDATE
    Opdrachtnummers SET Opdrachtnummer = Opdrachtnummer + 1")
    End Sub

    I got the following error:

    System.Security.SecurityException
    Request failed.
    at InfoPathProject4.InfoPathProject4.CTRL11_5_OnClick(DocActionEvent e)
    at
    Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent pEvent)

    This happens on the dimensions of Conn1 and/or Comm1. What can be wrong ?
    Help is appreciated.

    Regards, Ger.


    Carpe diem
  • 07-12-2005 11:52 PM In reply to

    Re: database connection problem in VB.net

    Hi Ger Eielts, Welcome to the Forum!
    Did you give Full trust to your form? When you are connecting to a DB through code you need to give Full trust to your InfoPath project, that is the reason that the exception is raised in the line where you are taking a DB connection.
    There are many posts about giving full trust to your InfoPath project.

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