Bineesh  Viswanath

Bineesh Viswanath

  • NA
  • 1k
  • 760.4k

ASP.NET GridView Fill Error

Aug 31 2013 5:27 AM
Sir, I having a situation where values are not retrieving from database to GridView.

But database table has values saved in it.


Here my tbl_Customer:-





The error is:-



So here I posting the all codes:-


1) SQL SP:-

ALTER PROCEDURE  customerviewAll
AS
   
   
SELECT  *
FROM  tbl_Customer



2) Sp class :-

   public DataTable ClassViewAll ( )
        {
            DataTable d = new DataTable ( );
            SqlDataAdapter a = new SqlDataAdapter ( "customerviewAll" , sqlCon );
            a . SelectCommand . CommandType = CommandType . StoredProcedure;
            a . Fill ( d );
            return d;
        }


3) And the .aspx.cs:-

 public void GridFill ( )
  {
  DataTable d = new DataTable ( );
  CSP sp = new CSP ( );
  d = sp . ClassViewAll ( );
  gvCustomers . DataSource = d;
  gvCustomers . DataBind ( );
 
  }

Please help me in this topic.


rror

Answers (13)