You have to return a string and not "string".
public string ExecuteScalar(String storedprocedure, params SqlParameter[] arrParam)
{
SqlConnection cn = new SqlConnection(connection());
try
{
DataSet dt = new DataSet();
SqlCommand cmd = new SqlCommand(storedprocedure, cn);
cmd.CommandType = CommandType.StoredProcedure;
if (cn.State == ConnectionState.Closed || cn.State == ConnectionState.Broken)
cn.Open();
if (arrParam != null)
{
foreach (SqlParameter param in arrParam)
cmd.Parameters.Add(param);
}
cmd.CommandTimeout = 5000;
return "success";
}
catch (Exception ee)
{
return "failer";
}
finally
{
cn.Close();
}
}