conexión de apertura y cierre para cada fila en gridview asp.net

I am new to programming and to stackoverflow. I need help on sql server 2008 and asp.net. I need to save multiple rows in database using gridview in asp.net. So for every row in gridview I ahve to open and close the connection in asp.net. Does opening and closing for every row has disadvantages. If any please tell.

preguntado el 05 de mayo de 13 a las 15:05

por favor revisa mi respuesta -

1 Respuestas

Opción 1:

fill the datatable with new rows send it to your DAL method , open the connection once and add rows one by one and after adding all rows close the connection

opción 2

again fill the datatable with new rows send it to your dal method , open the connection and use sqlbulkcopy class to add the rows at once.

and best approch is to use sqlbulkcopy

more one sqlbulkcopy can be found aquí

contestado el 05 de mayo de 13 a las 16:05

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.