Wierd Browser Form Submit Issue - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Wierd Browser Form Submit Issue

Last post 11-21-2007 08:42 AM by Matt Faus. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 11-09-2007 10:09 AM

    Wierd Browser Form Submit Issue

    Hi all, I have a form which is based on a webservice written in C#. The C# webservice contains a class library based on the schema of my form.

    It collects the data and then submits it to an SQL Server 2005 DB. When running the form in preview mode from a Client PC it submits fine but as an administrator approved browser form, when it is uploaded to my sharepoint site and filled out it returns an error.

    The error specified in the Sharepoint logs is that 'String or Binary data would be truncated', i am using the same data entry as for the client machine so am confused as why it errors in a browser?

     Here is the code for the webservice:

     [WebMethod]public void InsertGD(InfoPathService.GDFields GeneralData)

    {

    string ConnectionString = "Data Source=UKHQSPTEST002;Initial Catalog=SES;User ID=sa;Password=#5hareSQL";

    SqlConnection sqlconn = new SqlConnection(ConnectionString);

    sqlconn.Open();

    string sqlinsert = "Insert into GeneralData (vm, customer, program_code, vn, project_life, raised_date, start_date, sop_date, supply_basis, enquiry_date, rfq_date, deadline, replaces_previous, previous_enquiry, standard_comp, sales_value, tmc_available, capex_value, confirmed_quantity_a, confirmed_quantity_l, terms_understood, subdate_achievable, drawlevel_confirmed, requirements_defined, ds_available, npi_resource_available, site_confirmed, capacity_available, log_req_understood) values('" + GeneralData.vm + "', '" + GeneralData.customer + "', '" + GeneralData.program_code + "','" + GeneralData.vn + "', '" + GeneralData.project_life + "','" + GeneralData.raised_date + "', '" + GeneralData.start_date + "', '" + GeneralData.sop_date + "', '" + GeneralData.supply_basis + "','" + GeneralData.enquiry_date + "','" + GeneralData.rfq_date + "','" + GeneralData.deadline + "', '" + GeneralData.replaces_previous + "','" + GeneralData.previous_enquiry + "','" + GeneralData.standard_comp + "', '" + GeneralData.sales_value + "', '" + GeneralData.tmc_available + "','" + GeneralData.capex_value + "','" + GeneralData.confirmed_quantity_a + "', '" + GeneralData.confirmed_quantity_l + "', '" + GeneralData.terms_understood + "','" + GeneralData.subdate_achievable + "','" + GeneralData.drawlevel_confirmed + "','" + GeneralData.requirements_defined + "','" + GeneralData.ds_available + "','" + GeneralData.npi_resource_available + "','" + GeneralData.site_confirmed + "','" + GeneralData.capacity_available + "','" + GeneralData.log_req_understood + "')";SqlCommand command = sqlconn.CreateCommand();

    command.CommandText = sqlinsert;

    command.ExecuteNonQuery();

    sqlconn.Close();

    }

     

    Anyone got any ideas on why this might be erroring? I am really stuck.

     Thanks,

     Alex

     

  • 11-21-2007 08:42 AM In reply to

    Re: Wierd Browser Form Submit Issue

    Hi alex350r,

    Before you go writing your own custom web service layer, have you seen our DBXL product? It provides a generic web service layer that you can use to translate infromation from the InfoPath client in the the database, and then back again.  On top of this core functionality, there are a slew of other features that allow rapid form application development.

    For your error, you need to check the data types of all the columns in the database.  This will happen if you are trying to insert a value that is longer than you expected into the to the database.  So, if the DB type is nvarchar(10) and the user inputs a string longer than 10, then this error will be thrown.  That is probably the most often case I have seen of this error, but it can also happen with numeric types.

    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.