Home » Tutorials » ASP.NET » Inserting bulk records using JavaScript, asp.net

Inserting bulk records using JavaScript, asp.net

Select, Insert, Update, Delete-CRUD operation using Linq to Sql classes in asp net
comma separated string to table in sql server

Inserting single or bulk record(s) in Database using asp.net C# is not a big deal but considering performance with the operation is a topic to think on. Less db trips and including use of client side coding would really increase performance of the application.
Let us consider one simple example for bulk insert. We will insert Id, Name, Age of students in bulk in DB using javascript code and server side code as well. We have taken one button “Add new record” which will create html elements (Its widely known that using html controls rather than server controls will improve the performance of the web page) using javascript and then we will be able to insert all those records at once by clicking “Save” button and passing all data in form of xml to store procedure for inserting. Xml format would be like-

BulkInsertWithPerformance-1

BulkInsertWithPerformance-3

BulkInsertWithPerformance-4

Below is aspx page code-

Below is aspx.cs code-

Below is Store Procedure-

Please consider that this is just a basic example for inserting records in bulk with considering performance of the application. It would be really beneficial for real world application enviornment. Source code is attached here, which contains application solution and DB script.

Download Source code:  Inserting bulk records using JavaScript, asp.net

About

One thought on “Inserting bulk records using JavaScript, asp.net

  1. Arvind Yadav says:

    Uchit….Nice article. Thanks.. Special for Javascript code. It is very helpful….

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*

Time limit is exhausted. Please reload CAPTCHA.




DISCLAIMER:
The content is copyrighted to technothirsty.com and may not be reproduced on other websites without permission from the owner.You may contact us using the information below.