Friday, February 24, 2012

Error: The type or namespace name DataReader could not be found

In my DAL:

using System;
using System.Collections;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public DataReader getPersonList2() {
using (SqlConnection conn = getConnection())
{
SqlCommand cmd = new SqlCommand("PERSON_SP_getPersonList", conn);
cmd.CommandType = CommandType.StoredProcedure;
conn.Open();
return cmd.ExecuteReader();
}
}

In my BLL:

using System;
using System.Collections;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

DAL d = new DAL();

public DataReader getPersonList2(){
return d.getPersonList2();
}

I get the following error in my BLL:

Compiler Error Message:CS0246: The type or namespace name 'DataReader' could not be found (are you missing a using directive or an assembly reference?)

Source Error:


Line 34: }
Line 35:
Line 36: public DataReader getPersonList2(){
Line 37: return d.getPersonList2();
Line 38: }


Source File: c:\Inetpub\wwwroot\study\App_Code\BLL.cs Line: 36

Just wondering if someone could tell me why this is happening? I have the same namespaces that I have in the DAL in my BLL.

Puzzled.That should likely be SqlDataReader, not DataReader.|||public SqlDataReader getOUDetails(int SMU_Id) { SqlDataReader dr; string Qry = ""; con.Open(); cmd1 = new SqlCommand(Qry, con); return cmd.ExecuteReader(); cmd.Dispose(); con.Close(); }try do this way

No comments:

Post a Comment