Call an infopath textfield in codebehind using c#

63 Views Asked by At

I have 2 textfields:

Textfield 1 - the user types an input number

Textfield 2 - You get the result from what the user typed in the first textfield.

    public void Txb1_Changed(object sender, XmlEventArgs e)
    {
        AdoQueryConnection conn = (AdoQueryConnection)(this.DataConnections[@"Data Source=****;Initial Catalog=****;Integrated Security=True;Trusted_Connection=True"]);
        string origCommand = "Select Name from TableUsers where ID = '"+"TexField.Text"+"'";
        conn.Command = origCommand;
        conn.Execute();
        TextField2.Text = Database result; //here i want the result

    }

My problem is I don't know how to call textfield1 or textfield2 from my infopath form in order to manipulate them. Both Textfield are under MyFields form and i already made an sql connection which is working well. Hope someone can help

1

There are 1 best solutions below

0
pancake On BEST ANSWER