.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

how to insert multiple records at once

Posted By: Suma     Posted Date: February 25, 2009    Points:2   Category :ASP.Net
My task is to insert how to insert multiple records at once. I am using SQL Server 2005 as my database and asp.net with c# as my front end.

I am also using SQL Helper class to communicate with database.

Please help me

Responses
Author: Ruchi             
Posted Date: February 26, 2009     Points: 5   

Hi Suma,

you can possibly use an array to store N records and then use a loop to insert all N records one by one.

Author: Nabin             
Posted Date: August 27, 2009     Points: 5   

Hi Suma,

for that u have store all the data in a msexcel file, and u can upload that file in the front. then all the data will directly inserted in the database also.


Thanks
Nabin

Author: Ashutosh Jha             
Posted Date: December 30, 2013     Points: 20   

Hi,
you can use bulk insert for this. Store all the data in csv file and use below code. I have used this and this is a working code. try below and let me know if you will get any issue.

bulk 
insert tablename
from 'C:\filename.csv'
with
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)
go


Regards,
Ashutosh Jha
ashutosh741@gmail.com

http://www.tricksroad.com


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend