2012年2月16日星期四

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

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

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.

|||

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

没有评论:

发表评论