Click here to Skip to main content
15,947,389 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Pls help me in this problem
how can i insert fast in for loop using paramertizered query
<pre lang="c#">
for(int i=0;i<=10000;i++)
string qry="insert into demo(id,text,name,age,address)values(@id,@text,@name,@age,@address)";
MySqlParameter idP=new MySqlParameter(@id",0);
MySqlParameter textP=new MySqlParameter(@text,slipno/2012-13/);
MySqlParameter nameP=new MySqlParameter(@name,Ram);
MySqlParameter ageP=new MySqlParameter(@age,33);
MySqlParameter addressP=new MySqlParameter(@address",house no#01,new street,New delhi,India);
Love 2 code 12-Sep-13 4:15am    
Have you looked into bulk insert, and there might be another way look here:
pankajgarg1986 12-Sep-13 4:35am    
i am not using Bulkinsert due to address detai in my query.In Address it appears , then problem in insert

1 solution

That commenter got my vote. Yes I too go with BULK INSERT. If you don't want BULK INSERT then build single query & execute once(check the below link).
Insert multiple records into MySQL with a single query[^]
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900