Procedure ... expects parameter ... which was not supplied : ADO.NET Error

I had some problems with figuring out the cause about this error.

Procedure <procedure name> expects parameter <parameter name>, which was not supplied : ADO.NET Error

At last I found the solution on Data Mining Developers.

Example of the problem

string ColumnName = null;
//error will be thrown if the variabe ColumnName is null
if(ColumnName ==null)
ColumnName=string.Empty;
SqlParameter param = new SqlParameter("@ColumnName", SqlDbType.NVarChar, 100);
param.Value = ColumnName;
cmd.Parameters.Add(param);
cmd.Execute();

Comments

Please fill out all the fields.

*
*