Not all Code Paths return a Value Issue

Posted by jorame on Stack Overflow See other posts from Stack Overflow or by jorame
Published on 2012-09-24T02:37:42Z Indexed on 2012/09/24 3:37 UTC
Read the original article Hit count: 139

Filed under:
|
|

I have this peace of code in a class(DataBase) and I'm getting "Not all Paths return a Value". Any help will be really appreciated.

public static DataSet DELETE_PDT(String rowid)
{
    SqlConnection con = new SqlConnection();
    SqlCommand cmd = new SqlCommand("sp_DELETE_PDT", con);
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.Parameters.Add("@rowid", SqlDbType.Int).Value = rowid;

    con.ConnectionString = ConfigurationManager.ConnectionStrings["WMS"].ConnectionString;

    try
    {
        con.Open();
        cmd.ExecuteNonQuery();
        cmd.Dispose();
        con.Close();
    }

    catch (Exception ex)
    {
        throw new Exception("Error while deleting record. Please contact your System Administrator", ex);
    }
}

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET