Hi,
I am developing an ASP .NET 2.0 application with code behind in VB.
I have a dataset in which I have some data (1 table and around 200 rows) fetched from the Database.
Now my query is as follows:
I have to insert the value of this dataset to a table. I want to avoid using 200 insert statements (even in a loop). How can I achieve this efficiently.
I am thinking to create dynamic insert queries and appending them using StringBuilder.a ppend() method. So than I have a big string containing all the insert statements, delimited by newline character. Then I am thinking of passing this long string to a Stored Procedure present in my SQL Server. By this method I will not have to hit database for every insert statement from my codebehind and all the insert statements will be executed from my stored procedure.
Is this a proper idea. Or I should use some other method.
Please let me know.
Thanks
Pawan
I am developing an ASP .NET 2.0 application with code behind in VB.
I have a dataset in which I have some data (1 table and around 200 rows) fetched from the Database.
Now my query is as follows:
I have to insert the value of this dataset to a table. I want to avoid using 200 insert statements (even in a loop). How can I achieve this efficiently.
I am thinking to create dynamic insert queries and appending them using StringBuilder.a ppend() method. So than I have a big string containing all the insert statements, delimited by newline character. Then I am thinking of passing this long string to a Stored Procedure present in my SQL Server. By this method I will not have to hit database for every insert statement from my codebehind and all the insert statements will be executed from my stored procedure.
Is this a proper idea. Or I should use some other method.
Please let me know.
Thanks
Pawan
Comment