It used to be that I would recommend sending a large group of Stored Proc
calls to SQL Server in a single "batch" but the possibility of SQL Injection
attacks has brought those days to an end.
I would suggest that you present the U/I in any way that you see fit.
However, when it comes to sending updates to SQL, you are well served by
calling a stored proc that will decide if the change is an insert or an
update, and that you call one of them at a time (SqlCommand) and that you
use the parameter objects to avoid SQL Injection attacks.
Security trumps speed on this one, although the speed difference is tiny,
especially for most interactive applications.
--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik
Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Christopher" <Ch*********@discussions.microsoft.com> wrote in message
news:68**********************************@microsof t.com...
Greetings,
Fairly new to c# and Im looking for pointers on a few topics:
Im curious as to general methods to update multiple rows in a database.
Currently Im thinking of just allowing a user to update one row of data at
a time and designing/building textboxes to allow them to enter this data. I
would then use a method to insert this data. (sqlCommand)
Is there a more efficient method of updating 10 rows of data at a time?
Such that if I display the data in lets say a datagrid that they can edit the
data and I can programatically add this to the DB?
Along the same lines , what methods in general would be available to
distinguish between data being updated as compared to inserted? Any
methods that aid in this step. In my past programming , this wouldve fallen on the
programmer to decide(logic) if the row was present in the DB and to
update if not to insert.
As a side note: Im finding this site/newsgroup to a huge resource.
Thanks much,
Christopher