I get this error:
The out parameter 'errMsg' must be assigned to before control leaves the
current method
when compiling the following code:
public void ExecuteCommands (DDLCommands commands, out string
errMsg)
{
try
{
foreach (Command cmd in commands)
{
errMsg = "";
m_cmd.CommandTe xt = cmd.Expression( );
m_cmd.ExecuteNo nQuery();
}
}
catch (SqlException e)
{
errMsg = e.Message;
Console.WriteLi ne(e.Message);
}
}
I am initing the errMsg variable in the method body - so I dont
understand the error msg - what am I missing ?
The out parameter 'errMsg' must be assigned to before control leaves the
current method
when compiling the following code:
public void ExecuteCommands (DDLCommands commands, out string
errMsg)
{
try
{
foreach (Command cmd in commands)
{
errMsg = "";
m_cmd.CommandTe xt = cmd.Expression( );
m_cmd.ExecuteNo nQuery();
}
}
catch (SqlException e)
{
errMsg = e.Message;
Console.WriteLi ne(e.Message);
}
}
I am initing the errMsg variable in the method body - so I dont
understand the error msg - what am I missing ?
Comment