Save data in a database using custom code in InfoPath 2007 - InfoPath Dev
in

InfoPath Dev

Save data in a database using custom code in InfoPath 2007

Last post 04-14-2010 08:04 AM by alexia_net. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 04-14-2010 04:14 AM

    Save data in a database using custom code in InfoPath 2007

    Hi. I am trying to save data in a sql database using InforPath 2007 with my own code in Visual studio tools fro applications. I do not know how to connect the field i have on the template (form) with the code. For example in Visua Studio C# you write:

    variable_string = txtBoxTex.text.

    How do i Write the same in  Visual studio tools fro applications, how do i connect the textbox from the template(form) with the value i define in the code? Thank you!

    P.S. I am new with InfoPath. 

  • 04-14-2010 04:31 AM In reply to

    Re: Save data in a database using custom code in InfoPath 2007

    XPathNavigator xnFormName = null;

    XPathNavigator xnDoc = null;

    xnDoc = this.MainDataSource.CreateNavigator();

    xnFormName = xnDoc.SelectSingleNode("Field_Xpath_Path", this.NamespaceManager);

    variable_string= xnFormName.Value;

    //To get field xpath -> in design task -> Data source -> right click on the field and click Copy XPath

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 04-14-2010 04:57 AM In reply to

    Re: Save data in a database using custom code in InfoPath 2007

      Thank you so much Qazi Anis. I did the job!

    :-bd

  • 04-14-2010 05:12 AM In reply to

    Re: Save data in a database using custom code in InfoPath 2007

     There is one more thing. When I am using

     XPathNavigator(xnFormName = null)

    i get this error

    Error    1    'XPathNavigator' is a type and cannot be used as an expression.  

    I have commented the line and the program works, but why the error?

    Thank you!

     

  • 04-14-2010 05:31 AM In reply to

    Re: Save data in a database using custom code in InfoPath 2007

    what are you trying to achieve by

    XPathNavigator(xnFormName = null)

    i think you should try

    xnFormName= Xndoc.SelectSingleNode("XPATH",this.NamespaceManager);

    if (xnFormName == null)

    {

    //your code

    }

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 04-14-2010 08:04 AM In reply to

    Re: Save data in a database using custom code in InfoPath 2007

     Thank you cery much!

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