>>> For what it's worth,I ended up making my insert routines stored procedures and specifying the PK as an output parameter.
>
>IMO, this is the better approach. Especially the user of the OUTPUT parameter to return the value.
>
>>> Not what I wanted to do in all cases ...
>
>Why not?
>
>-Mike
Doing the parameter thing is a lot of coding. 2 lines per parameter in ADO .NET.
2 stored procedures in SQL server (insert, update) . Leaving me with 3 places to keep up to date in code.
I like using a SP and parameters when I am gathering user entered text where I am likely to get a quote or something that will crash the entire command if it is being prepared as a text string or if the SQL server needs tight security and I cannot allow others (IE: aspnet, iuser) to send it commands directly.
There are times when the above are not issues and I’d rather just send a simple text command and be done with it.
Chris