My stored procedure ( SQL 2012 )works fine from SQL Server Management Studio. However when I use C# with System.Data.SQLClient to invoke the stored procedure, no update takes place and no error is raised.
The C# Function is below - any ideas ??
public int UpdateValuesbySP(string FunctionName, Hashtable theParams)
{
int retVal=-1;
SqlCommand command = new SqlCommand();
if (staticSQLConn.State == ConnectionState.Closed)
{
staticSQLConn.Open();
}
// set command
try
{
command.Connection = staticSQLConn;
command.Parameters.Clear();
if (theParams != null)
{
foreach (DictionaryEntry item in theParams)
{
command.Parameters.AddWithValue(item.Key.ToString(), item.Value);
}
}
command.CommandType = CommandType.StoredProcedure;
command.CommandText = FunctionName;
retVal = command.ExecuteNonQuery();
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
return retVal;
}
andrew