Submitting many fields to a SQL Database RRS feed

  • Question

  • I'm using a Browser-Based form 2007 that is connected to a C# web service that submits data to a SQL 2008 database via a Stored Procedure. I'm looking for suggesstion on how best to submit a large quantity of fields that the users submits? Can I package the values in a String array and pass them through to the Web Service and on to the Stored Proc? Can Infopath handle arrays? Any good examples?


    Sunday, February 19, 2012 12:34 AM



    Hi mwhite01 ,

    You can use a table of object. If you use object, you will no need to use string arrays . here is then sample code from the link.


    public int AddNewEmployee(Employee employee)


      int rowsAffected = 0;

      using (SqlConnection conn = new SqlConnection("..."))


        SqlCommand cmd = new SqlCommand("INSERT INTO Employees " +

          "(EmployeeNumber, Title, FirstName, LastName, Salary) " +

          "VALUES(@EmployeeNumber, @Title, @FirstName, @LastName, @Salary)", conn);

        cmd.Parameters.AddWithValue("@EmployeeNumber", employee.EmployeeNumber);

        cmd.Parameters.AddWithValue("@Title", employee.Title);

        cmd.Parameters.AddWithValue("@FirstName", employee.FirstName);

        cmd.Parameters.AddWithValue("@LastName", employee.LastName);

        cmd.Parameters.AddWithValue("@Salary", employee.Salary);


        rowsAffected = cmd.ExecuteNonQuery();


      return rowsAffected;


    More about it please refer to the following link.




    Wednesday, February 22, 2012 2:27 AM