none
How to update and send mail after submiting infopath form in Sharepoint RRS feed

  • Question

  • Hello All,

    i am working on one sharepoint project ,Can anybody tell me How to update database and send mail after submiting infopath form in Sharepoint.

    Please help me its urgent !!

    Thanks & Regards,

    Gaurav Badhani

    Monday, August 5, 2013 4:36 PM

Answers

  • Hi Badhani.

    For this situation, if you are using sql server database, you could access to the following link to get further information about Creating an InfoPath Form:

    http://www.c-sharpcorner.com/uploadfile/pawanjajoo/creating-an-infopath-form/

    You can see how to update sql server in submit event like this:

    public void Submit_Clicked(object sender, ClickedEventArgs e)
    {
        string _position = MainDataSource.CreateNavigator().SelectSingleNode                     
        ("/my:myFields/my:Position", NamespaceManager).Value;               
        string _description = MainDataSource.CreateNavigator).SelectSingleNode
        ("/my:myFields/my:Description", NamespaceManager).Value;
        string _category = MainDataSource.CreateNavigator().SelectSingleNode
        ("/my:myFields/my:Category", NamespaceManager).Value;
        string _location = MainDataSource.CreateNavigator().SelectSingleNode     
        ("/my:myFields/my:Location", NamespaceManager).Value;
       string _connstring;
        SqlConnection _oConnection;
          SqlCommand _oCommand = new SqlCommand();
          _connstring = @"DataSource=./SQLExpress;Initial  Catalog=My_DB;Integrated Security=SSPI";
          _oConnection = new SqlConnection(_connstring);
          _oCommand.Connection = _oConnection;
          _oCommand.CommandType = CommandType.Text;
          _oCommand.CommandText =
          "INSERT INTO tbl_Position (Position,Description,Category,Location) values 
          ('" + _position + "','" + _description + "','" + _category + "','" + _location + "')";
         _oConnection.Open();
         _oCommand.ExecuteNonQuery();
         _oConnection.Close();            
    }
    

    For sending email, you can refer to the below link about how to send mail from a infopath form in sharepoint :

    http://www.bizsupportonline.net/browserforms/send-email-infopath-browser-form-sharepoint.htm

    Hope this will help you.


    George Hua
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, August 7, 2013 9:48 AM
    Moderator