2015-12-23 4 views
1

J'ai 2 textfields:Appelez un textfield InfoPath dans codebehind en utilisant C#

textField 1 - les types d'utilisateur un numéro d'entrée

Textfield 2 - Vous obtenez le résultat de ce que l'utilisateur a tapé dans le premier champ de texte.

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 

    } 

Mon problème est que je ne sais pas comment appeler TextField1 ou TextField2 de mon formulaire InfoPath afin de les manipuler. Les deux Textfield sont sous la forme MyFields et j'ai déjà fait une connexion SQL qui fonctionne bien. Espérons que quelqu'un peut aider

Répondre