Simon Mourier's Avatar
Simon Mourier's blog (1807 answers on StackOverflow) about Microsoft technologies C#, C/C++, .NET, WinRT, WinUI3, AOT, P/Invoke, COM, Interop, DirectX, Direct2D, Windows, ...
  • 🔎︎ Search
  • Categories
  • Archives
  • About Me
  • asp.net
  • c#
  • sql

C# Run a procedure without specifying a parameter name

Aug 2, 2016 See the question and my original answer on StackOverflow

You can create a nameless SQL parameter if you force its name to null or empty after it's been added to the Parameters collection, something like this:

var par = cmd.CreateParameter();
par.Value = myValue;
cmd.Parameters.Add(par); // this will change the name to "ParameterX"
par.ParameterName = null;
  • SmoBlog © 2010-2026 Simon Mourier. All rights reserved.
  • Privacy & Terms