Form and DataBase - InfoPath Dev

InfoPath Dev

Use our Google Custom Search for best site search results.

Form and DataBase

Last post 06-11-2006 12:47 AM by liorlankri. 12 replies.
Page 1 of 1 (13 items)
Sort Posts: Previous Next
  • 05-31-2006 03:12 AM

    Form and DataBase

    I have an InfoPath form. One of it's fill out fileds is: "IDnumber"
    I want that after the user enter the IDnumber, It will searching for this IDnumber in the SQL server DB and will return answer if it exist in the SQL DataBase (I know I need to operate OnAfterChange Event).

    I dont need the code for this I just want to know the best way to this:

    Must notice that:
    1) I desgined the form from a New Blank Form (not from data connection).
    2) My form can be .NET project (c#) or regular form designer (Code in script editor)

    I will give some leading question
    1) should I create (case of .NET code) a web referernce to a WEb Service that contain method that check it, and to operate the WS from the form's code (by the Web Refernce object)?

    2) should I create Data Connection to the specific method of the WS that check it (case of not .NET project or .NET project) and to operate this Data Connection from the form's code (VBscript or Javascript or c#). If yes so I want to know which type should the Data Connection be (Submit or Recive)? How to operate this Data Connection from the code (need code Example)?

    3) Can I do it without WS? How?

    I'm asking this because:
    1) I want to avoide built my project in .NET (I dont want the users to install .NET Framework on their machins).
    2) In order to do 1 I need to avoid adding Web Reference (to a WS)
    3) I want to avoid give my form a Full Trust Security (and if I use Web Refernce I will need to do this) since I dont want to install it on each machin or to sign it!

    Must Help and answers!!
  • 05-31-2006 04:37 AM In reply to

    Hi Liorlankri,

    As specified in case2, u should create a Dataconnection to the web service.And u should create a "Receive" data connection to ur web service.

    By using "Receive" dataconnection,u will be able to send data from ur form to the webservice and also receive data from ur webservice.

    And regarding ur 3rd question, u cannot do it without using a webservice becoz u donot have an option to query the database when u establish a "Receive" data connection to it.

    Now to avoid installing .NET framework in users machine, write JScript code to query the "Receive" dataconnection to ur webservice.

    When querying, donot forget to pass the "IDNumber" to ur queryfield in ur secondary datasource.


  • 06-03-2006 10:14 PM In reply to

    Thank you Abhishek!
    You help me a lot
    Now I need code example (in JavaScropt or VBscript) to query the "Receive" dataconnection to my webservice.
    Can you help me with this??
  • 06-04-2006 01:54 AM In reply to

    By the way!
    Can I do it by using ADOAdapter Object of InfoPath (without using web service)?
  • 06-05-2006 01:47 AM In reply to

    Hi Liorlankri,
    This is the code to query the receive data connection to a web service.It also shows u how to send a input parameter to the web service.

    It is in C# though.For JScript, it requires very minor modifications.

    IXMLDOMDocument3 wsDOM = IXMLDOMDocument3)thisXDocument.DataObjects["<DataConnection Name>"].DOM;

    //Set the SelectionNamespaces so that you can find the correct field
    + " xmlns:tns=\"\"");

    //Set Web Service input parameters
    wsDOM.selectSingleNode ("/dfs:myFields/dfs:queryFields/tns:FindADSUsers1/tns:FirstOrLastName").text =e.Source.selectSingleNode("my:RoleApproverEditable").nodeTypedValue.ToString();

    //Requery the webservice datasource
    thisXDocument.DataObjects["<DataConnection Name>"].Query();

    Now in JScript, u need to do minor modifications like
    replace "thisXDocument" needs to be replaced by "XDocument".

    So the final requerying the webservice statement would be like...

    XDocument.DataObjects("Name of your Data Connection").Query();

  • 06-05-2006 03:34 AM In reply to

    O.K! Thank you.
    But I need to get a value back. How to cath it? can I do
    bool Val=XDocument.DataObjects("Name of your Data Connection").Query(); ?
  • 06-06-2006 10:20 PM In reply to

    U dont have to do that.
    Just go to ur datasource task pane.Select ur secondary datasource in the dropdown.
    U can find all the datafields.U just need to drag that field to ur form.

    But data in the secondary data source is not saved when u save or submit the form.
    So u can transfer it to ur main data source if u need it to be saved in the form's xml when u save the form.

  • 06-07-2006 04:46 AM In reply to

    I have defenition problem
    dataDom.setProperty ("SelectionNamespaces","xmlns:dfs=""" "xmlns:tns=""")

    I get error this
    "Expected end of statement"
    What's not good?
  • 06-07-2006 05:18 AM In reply to

    What should be the "dfs" defenition and the "tns" defenition??
  • 06-07-2006 06:40 AM In reply to

    Open the Manifest.xsf in a text editor.
    U can find the "dfs" or "tns" defns there.
    Expected end of statement is becoz u have not given a semicolon at the end of that particular line.
  • 06-07-2006 09:44 PM In reply to

    I still dont understand the correct syntax to this line

    dataDom.setProperty "SelectionNamespaces", "xmlns:dfs=""" "xmlns:tns="""

    I get error this
    "Expected end of statement"
    How to fix it? what's the syntax?
  • 06-08-2006 07:20 AM In reply to

    I have taken an example from the SDK.
    Just compare ur syntax with this one.May be u have gone wrong somewhere with the double quotes and single quotes.

    XDocument.GetDOM("Customers (USA)").setProperty("SelectionNamespaces",
    'xmlns:q="" ' +
    'xmlns:d="" ' +
    objCustomerLookupNode = XDocument.GetDOM("Customers(USA)")
    .selectSingleNode( "//d:Customers[@CustomerID='" + strCustomerId + "']");

    Take a look at the single Quotes and double Quotes.

    Take a look at the following link

  • 06-11-2006 12:47 AM In reply to

    It's work!!!!

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