Querying SQL data from a search box. - InfoPath Dev
in

InfoPath Dev

Querying SQL data from a search box.

Last post 05-31-2013 05:56 AM by wilkies0106aw. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 05-22-2013 03:55 AM

    Querying SQL data from a search box.

    All,

    I've connected an infopath form to an MS sql db.

    On my Inforpath (2010) form I have a field called SearchName with a button underneath the field which queries the data from the SQL db.

    On my form I have a repeating table which only shows data when the SearchName field is equal to a field on the repeating table.

    How can I use a bit more intelligence to the SearchName box/results? i.e if my SearchName value is Monday, the table returns Monday, monday or monday1 ? At present it will only return Monday.

    The person filling out the searchName box will not always type in Monday so zero results will be presented. (I'll need a field of something which the person know there are zero results too).

    In addion should I be doing the search within the form or somewhere else? i.e. on the db itself? The form takes a long time to query the data.

    Filed under:
  • 05-22-2013 10:40 AM In reply to

    Re: Querying SQL data from a search box.

    I think to query for just the items you need, you'll need code or a web service (like DBXL) to be able to get back items that are "like" what you are searching for (wildcard search) - I'm just thinking, my users are going to type in Henry and want to get back Henry Smith and Henry Jones, you know?

    If you take that route, you probably won't need to worry about case sensitivity.

    But if you have all data in your form and are just using conditional formatting / filters to display / hide - you should probably try the translate function to get things into a single case for comparison - sample here: http://melick-rajee.blogspot.com/2010/08/getting-lower-case-lcase-and-upper-case.html

    Hilary Stoupa

  • 05-23-2013 08:49 AM In reply to

    Re: Querying SQL data from a search box.

     Thanks for the advice, I think that's where I might end up.

  • 05-31-2013 05:56 AM In reply to

    Re: Querying SQL data from a search box.

    On a role today. I found this link - http://social.msdn.microsoft.com/Forums/en-US/sharepointcustomizationprevious/thread/5aa4519c-b8e0-4a7c-85b4-09f7e1d0747a

    Copied the code and altered it for my needs. i.e. connection name etc.

    Make sure your form can use C# File>Form Options>Programming>C#

    The code is placed onto your button:

    As long as you have an SQL person who can write the stored procedure

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