Sql accessing by code-sqlclientpermission error - InfoPath Dev
in

InfoPath Dev

Sql accessing by code-sqlclientpermission error

Last post 01-03-2006 08:02 AM by mar. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 01-01-2006 01:53 PM

    • mar
    • Top 500 Contributor
    • Joined on 09-04-2005
    • Poland
    • Posts 37

    Sql accessing by code-sqlclientpermission error

    Hello, i wrote a simply code(opening connection,select statement,get data) which gets from sql base some data(and im publishing this data to listbox by a repeating table). On my computer, when im building and testing project form visual studio2003, everything is ok, my code works.But, when i publish my form to sharepoint library and try to run, i've got an error:
    System.Data.SqlClient.SqlClientPermission, System.Data, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    [...]
    at System.Security.CodeAccessSecurityEngine.CheckTokenBasedSetHelper(Boolean ignoreGrants, TokenBasedSet grants, TokenBasedSet denied, TokenBasedSet demands)
    at System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet grants, PermissionSet denied, PermissionSet demands)
    [...]

    Is anyway to avoid this?How?I was trying [SqlClientPermissionAttribute(SecurityAction.Assert, Unrestricted=true)] before my method, but this doesnt work...help...
  • 01-02-2006 05:52 PM In reply to

    Re: Sql accessing by code-sqlclientpermission error

    Best way to avoid it is to use a Web service. We have written forms that integrate with SQL directly and do not require Full Trust. I will ask Agni to respond since I know he has experience in this area.

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 01-03-2006 12:59 AM In reply to

    • mar
    • Top 500 Contributor
    • Joined on 09-04-2005
    • Poland
    • Posts 37

    Re: Sql accessing by code-sqlclientpermission error

    But when im using a webservice in code ive got webpermission error, and infopath can't send AND receive data from webservice datasource?Im not using form builded from data source, and in my project i can only set 'send data connection' and 'receive data connection' but not 'send and receive'(in one). When i send data to webservice it produces data form but...how to get this data?
  • 01-03-2006 07:10 AM In reply to

    Re: Sql accessing by code-sqlclientpermission error

    Hello,
    InfoPath has default functionality that allows you to retrieve data from the DB without having to write code. If you write code to retrieve data then you will have to give full trust to the form.

    How to retrieve data from the DB directly via InfoPath
    1. Click on Tools -> Data connections
    2. Click on Add and select Receive in the radio button options and click on Next
    3. Select Database and click on Next
    4. Click on Select Database and create a data connection to the database. This is place where you edit the SQL query specifically if you so wish by clicking on Edit SQL.
    5. Click on Next and then Click on Finish

    From now on whenever the form is opened it will retrieve the latest information from the database.

    Hope this Helps!

    Shailaja
    InfoPath Dev India
  • 01-03-2006 08:02 AM In reply to

    • mar
    • Top 500 Contributor
    • Joined on 09-04-2005
    • Poland
    • Posts 37

    Re: Sql accessing by code-sqlclientpermission error

    Hello and thanks for answer. I do not want to do it this way, because i want a button, which will send a string from a field as a part of sql query 'select field.text from ....', and i do not want to save my sql login and password in text file.When this is done by code, login and passwd are store in dll, so this is some kind of security. I'm working now on signin form by certificate.
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.