| Author: Vijay 17 Jul 2008 | Member Level: Silver | Rating:  Points: 4 |
If you want to insert all the rows from the datatable then go for foreach loop. as follows.. Create SqlConnection Create SqlCommand foreach(DataRow dr in DataTable.Rows) { SqlCommand = new SqlCommand("CommandText(i.e, Insert Statement)", ConnectionObject); SqlCommand.ExecuteNonQuery(); }
Follow this simple steps might solve your problem.
|
| Author: vipul 17 Jul 2008 | Member Level: Diamond | Rating:  Points: 4 |
Hi, for inserting record in the database you used datat able it is the best way doing this way
In c# ----- foreach(DataRow dr in DataTable.Rows) { // This loop is running total of data table row // And you get the column value this way dr["cloumnName"] // then insert into database. }
vipul, http://dongavipul.blogspot.com
Please Rate This Answer If They Helpful
Thanks & Regards Patel Vipul
|
| Author: Tushar Jindle 17 Jul 2008 | Member Level: Silver | Rating:  Points: 3 |
hi thanks for your prompt response but actually i dont know what to write here
SqlCommand cmd = new SqlCommand("CommandText(i.e, query)", con); so please help me I'm attaching my code file thanks
Data Entry.aspx.cs |