Error : The Out Parameter must be assigned before control leaves the current method
===

While sending back parameters getting this error

> Error : The Out Parameter must be assigned before control leaves the
> current method

Code is

   public void GetPapers(string web, out int Id1, out int Id2)
    {
        SqlConnection conn = new SqlConnection(ConnectionString());
        conn.Open();
        SqlCommand cmd = new SqlCommand("GetPapers", conn);
        cmd.CommandType = CommandType.StoredProcedure;

        cmd.Parameters.Add(new SqlParameter("@URL", String(web)));

        SqlDataReader rdr = cmd.ExecuteReader();

        if (rdr.Read())
        {
            Id1 = (int)rdr["ID1"];
            Id2 = (int)rdr["ID2"];
        }

        rdr.Close();
    }

calling it as

    GetPapers(web, out Id1, out Id2);

Related to this question

[Related question][1]


  [1]: http://stackoverflow.com/questions/11737497/sending-2-parameters-back-to-main-function/11737538#comment15577485_11737538