<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>General</title><link>https://www.infopathdev.com:443/forums/41.aspx</link><description>If you're not sure where to ask your question, ask it here. If necessary, our moderators will make sure it gets classified in the correct board.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>[RESOLVED] Datatypes mismatch in SQL server and Infopath</title><link>https://www.infopathdev.com:443/forums/thread/30082.aspx</link><pubDate>Thu, 03 Jul 2008 17:18:46 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:30082</guid><dc:creator>swetha</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/30082.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=30082</wfw:commentRss><description>&lt;p&gt;Hello,&amp;nbsp;&lt;/p&gt;&lt;p&gt;I found the problem to be with the field &lt;b&gt;Service_count&lt;/b&gt;, which failed to convert the boolean values to a number. I retained the datatype for the 3 services in the SQL database as &lt;b&gt;&amp;quot;bit&amp;quot;&lt;/b&gt;&amp;nbsp; and service_count as &lt;b&gt;&amp;quot;int&amp;quot;&lt;/b&gt;&amp;nbsp; and in the form I have the 3 services inserted&amp;nbsp; as &lt;b&gt;&amp;quot; boolean&amp;quot;&lt;/b&gt; fields, and default values for the services to be &amp;quot;True/False&amp;quot;.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;I used the formula for service_count as :&amp;nbsp;&amp;nbsp; &lt;b&gt;number(contains(service1, &amp;quot;true&amp;quot;)) + number(contains(service2, &amp;quot;true&amp;quot;)) + number(contains(service3, &amp;quot;true&amp;quot;))&lt;/b&gt; .,which works as I intended it to.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Cheers.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Datatypes mismatch in SQL server and Infopath</title><link>https://www.infopathdev.com:443/forums/thread/30036.aspx</link><pubDate>Wed, 02 Jul 2008 15:32:54 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:30036</guid><dc:creator>swetha</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/30036.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=30036</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hi,&lt;/p&gt;&lt;p&gt;I have a problem when trying to submit an Infopath&amp;nbsp; form.The scenario is as follows:&lt;/p&gt;&lt;p&gt;I have an infopath form which talks to SQL server via a webservice to query and submit data.&amp;nbsp;&lt;/p&gt;&lt;p&gt;I have SQL server 2005 database which has a table for services provided&amp;nbsp; for a given &lt;b&gt;studentID&lt;/b&gt;. Fileds and the data types of the table are :&lt;b&gt; studentID&lt;/b&gt;(int) | &lt;b&gt;service1&lt;/b&gt;(bit) |&lt;b&gt;Service2&lt;/b&gt;(bit) | &lt;b&gt;Service3&lt;/b&gt;(bit) | &lt;b&gt;service_count&lt;/b&gt; (int).&lt;/p&gt;&lt;p&gt;The 3 services contain the value of &amp;#39;True&amp;#39; or &amp;#39;False&amp;#39; depending on whether they are checked or not in the infopath form .The &lt;b&gt;service_count&lt;/b&gt; field gives the total count of services selected in each row.&lt;/p&gt;&lt;p&gt;The C# code for the insert&amp;nbsp; looks like this:&lt;/p&gt;&lt;p&gt;this.sqlInsertCommand3.CommandText = &amp;quot;INSERT INTO [Services] ([studentID], [service1], [service2], [service3], [service&amp;quot; +&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;_count]) VALUES (@studentID, @service1, @service2, @service3, @service_count)&amp;quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.sqlInsertCommand3.Connection = this.sqlConnection1;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.sqlInsertCommand3.Parameters.AddRange(new System.Data.SqlClient.SqlParameter[] {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new System.Data.SqlClient.SqlParameter(&amp;quot;@studentID&amp;quot;, System.Data.SqlDbType.Int, 0, &amp;quot;studentID&amp;quot;),&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new System.Data.SqlClient.SqlParameter(&amp;quot;@service1&amp;quot;, System.Data.SqlDbType.Bit, 0, &amp;quot;service1&amp;quot;),&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new System.Data.SqlClient.SqlParameter(&amp;quot;@service2&amp;quot;, System.Data.SqlDbType.Bit, 0, &amp;quot;service2&amp;quot;),&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new System.Data.SqlClient.SqlParameter(&amp;quot;@service3&amp;quot;, System.Data.SqlDbType.Bit, 0, &amp;quot;service3&amp;quot;),&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new System.Data.SqlClient.SqlParameter(&amp;quot;@service_count&amp;quot;, System.Data.SqlDbType.In&lt;i&gt;t, 0, &amp;quot;service_count&amp;quot;)});&lt;/i&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;/p&gt;&lt;p&gt;Now when I create the infopath form and insert the nodes ,the service fields have the data type of &amp;quot;&lt;b&gt;unsignedByte&lt;/b&gt;&amp;quot;.&lt;/p&gt;&lt;p&gt;I add rule to the field &lt;b&gt;service_count&lt;/b&gt; in the form as &lt;b&gt;sum(service1|service2|service3)&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Now when I submit the form I get the error as follows :&lt;/p&gt;&lt;p&gt;&amp;gt;Infopath cannot submit the form&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;gt; The SOAP response indicates that an error occurred on the server:&lt;br /&gt;&lt;br /&gt;System.Web.Services.Protocols.SoapException: Server was unable to process request. ---&amp;gt; System.FormatException: Failed to convert parameter value from a String to a Boolean. ---&amp;gt; System.FormatException: String was not recognized as a valid Boolean.&lt;br /&gt;&amp;nbsp;&amp;nbsp; at System.Boolean.Parse(String value)&lt;br /&gt;&amp;nbsp;&amp;nbsp; at System.String.System.IConvertible.ToBoolean(IFormatProvider provider)&lt;br /&gt;&amp;nbsp;&amp;nbsp; at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)&lt;br /&gt;&amp;nbsp;&amp;nbsp; at System.Data.SqlClient.SqlParameter.CoerceValue(Object value, MetaType destinationType)&lt;br /&gt;&amp;nbsp;&amp;nbsp; --- End of inner exception stack trace ---&lt;br /&gt;&amp;nbsp;&amp;nbsp; at System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)&lt;br /&gt;&amp;nbsp;&amp;nbsp; at System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)&lt;br /&gt;&amp;nbsp;&amp;nbsp; at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)&lt;br /&gt;&amp;nbsp;&amp;nbsp; at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping)&lt;br /&gt;&amp;nbsp;&amp;nbsp; at System.Data.Common.DbDataAdapter.Update(DataTable dataTable)&lt;br /&gt;&amp;nbsp;&amp;nbsp; at Service.SetDataSet(DataSet1 studentData) in c:\Users\t3mantri\Documents\Visual Studio 2005\WebSites\070108\App_Code\Service.cs:line 50&lt;br /&gt;&amp;nbsp;&amp;nbsp; --- End of inner exception stack trace ---&lt;br /&gt;&lt;br /&gt;&amp;nbsp;There must be some type mismatch in the datatypes i the sql server and infopath. however when I change the datatype as &lt;b&gt;tinyint&lt;/b&gt;&amp;nbsp; in SQL server and boolean in the infopath form ,I am able to submit.&lt;/p&gt;&lt;p&gt;How can I fix this problem. I want to retain the datatype for the service fields as &lt;b&gt;bit&lt;/b&gt; in SQL server.&lt;/p&gt;&lt;p&gt;Thanks in advance.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>