How Do I write the entire form to SQL? - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

How Do I write the entire form to SQL?

Last post 03-13-2011 12:33 AM by Patrick Halstead. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 03-11-2011 12:14 PM

    How Do I write the entire form to SQL?

     Hello,

    I created a 2010 InfoPath form and setup a web service to try and write the entire form to SQL. When I click submit it writes the record to SQL, but nothing shows in my JobRequest table XMLForm Field.I set the web service parameters to "entire form (xml document, including...)

    Can someone tell me what I'm doing wrong? Thank You.

     

    CREATE TABLE [dbo].[JobRequest](
        [JobRequestID] [int] IDENTITY(1,1) NOT NULL,
        [RequestDate] [datetime] NULL,
        [LastName] [varchar](30) NULL,
        [FirstName] [varchar](30) NULL,
        [EmailAddress] [varchar](50) NULL,
        [SSN] [varchar](50) NULL,
        [XMLForm] [xml] NULL,
        [CreateDate] [datetime] NULL,
     CONSTRAINT [PK_JobRequest] PRIMARY KEY CLUSTERED
    (
        [JobRequestID] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY]


    CREATE PROCEDURE [dbo].[sp_Update_JobRequestXML]
    @XMLForm xml
    AS
      BEGIN
         INSERT INTO JobRequest
         values
          (null, null, null, null, null, @XMLForm, GETDATE())
      END
     

     

       [WebMethod]
       public string[] AddJobRequestXML(XmlDocument XMLForm)
            {
                clsEmployee cEmployee = new clsEmployee();
                cEmployee.XMLDoc = XMLForm;
                cEmployee.AddJobRequest();
                return null;
            }

        public class clsEmployee
        {
            SqlParameter[] _paramArr;
            public XmlDocument _XMLDoc;
            public void AddJobRequestXML()
                {
                    _paramArr = new SqlParameter[1];
                    _paramArr[0] = new SqlParameter("@XMLForm", SqlDbType.Xml);
                    _paramArr[0].Value = _XMLDoc.InnerXml;
                    SqlHelper.ExecuteNonQuery(ConfigurationManager.ConnectionStrings["cfsconn"].ToString(), "sp_Update_JobRequestXML", _paramArr);
            }
        }

  • 03-13-2011 12:33 AM In reply to

    Re: How Do I write the entire form to SQL?

    Hey Outfox InfoPath,

    Looks like your Web Method doesn't support submitting the form as an XML string. You should install DBXL to see how it should be done. :)

    Good luck! Let me know if I'm confused.

    Patrick Halstead
    Project Manager at Qdabra
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.