Not sure what answer your looking for, stored procedure command text & parameters are passed to the driver/provider or natively via ADO.NET which formats it as a TDS (tabular data stream) RPC (remote procedure call) Message which is then passed to the server over which ever network protocol is being used; pipes, tcp/ip et al. The data is sent in a binary stream.
The TDS spec is available from Microsoft if your interested.
SQLCommand
Stored Procedure calls do need a parameter name, its OleDB/ODBC that only care about the order and use ?
as the parameter placeholder rather than @NAME
.
Regarding order
In your example the order is not relevant because you are providing the server with the correct names for the params, so this is what is sent to the server:
exec paramtest @par3=N'third',@par2=N'second',@par1=N'first'
This is enough information for the server to figure out the correct params/order.
If you changed to
addParam(cmd, "@xxpar3",
addParam(cmd, "@xxpar2",
addParam(cmd, "@xxpar1",
The server would detect that it does not have a param named xxxpar*
and fail with a "missing @par1" error.
If you modified addParam
so it did not set paramater names .net will create defaults:
exec paramtest @Parameter1=N'third',@Parameter2=N'second',@Parameter3=N'first'
Which would cause the above error.
If you modified addParam
so it did not set paramater names and then overwrite the automatic ones;
cmd.Parameters.Add(par);
par.ParameterName = "";
This is what gets executed:
exec paramtest N'third',N'second',N'first'
resulting in
@par1 = third; @par2 = second; @par3 = first
I have no idea what Delphi does ... The full version of SQL Server ships with a tool called SQL Profiler which displays the textual data that gets sent to the server instance so you can see exactly whats going on. What profiler to use with sql express?