locked
Any easy Class method to update about 100 fields of a database using stored procedure? RRS feed

  • Question

  • User-100755152 posted

    Hi all,

     I am using  C# for ASP.NEt 2003.

    I would like to know if there is any easy method to update a database with about 100 fields in it.

    At present, I pass all the values of the controls on the web form to the stored procedure as parameters like :-

    myCommand.Parameters.Add("@CustomerID", SqlDbType.Int).Value = txtCustomerID.text

    Like this,  I add all 100 parameters.

    Is there any easy method to do it using a class or any other methods?

    Thanking you in advance,

    Tomy

    Thursday, February 1, 2007 3:35 AM

Answers

  • User1866903671 posted

    I assume that you have win form. It is possible to have a table in your application which will have field for each input data field on your form, you can bound your form controls to data so they will be automatically updated. Next you can use data adapter with insert and/or update statements(it can be your stored procedure) defined to run with parameters based on your table. I do not know if it will work for you but it is probably the only solution where you do not have to pass all your values to parameters of stored procedure.

    Thanks

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, February 1, 2007 9:40 AM

All replies

  • User-1386562875 posted

    I my opinion not, this is why Microsoft developed LINQ in C# 3.0.

    To be able to create objects that can be passed as parameters.

    Thursday, February 1, 2007 8:53 AM
  • User1866903671 posted

    I assume that you have win form. It is possible to have a table in your application which will have field for each input data field on your form, you can bound your form controls to data so they will be automatically updated. Next you can use data adapter with insert and/or update statements(it can be your stored procedure) defined to run with parameters based on your table. I do not know if it will work for you but it is probably the only solution where you do not have to pass all your values to parameters of stored procedure.

    Thanks

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, February 1, 2007 9:40 AM