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

Sanjeeb LenkaPosted Aug 31, 2013, 7:07 AM
try this
Width="100%">
Bineesh ViswanathPosted Aug 31, 2013, 7:24 AM
Ramakrishna PathuriPosted Aug 31, 2013, 7:20 AM
Abhishek JainPosted Aug 31, 2013, 7:08 AM
The DataField column name in your ASPX for every BoundField should be same as your column names, that is why you are getting this error.
Now it is Mobileno
Sanjeeb LenkaPosted Aug 31, 2013, 7:04 AM
this error is due to your phone column is not present in table.
plz share your table column names so that we will get a clear idea what column present in table and you are binding to grid.
Bineesh ViswanathPosted Aug 31, 2013, 7:04 AM
Bineesh ViswanathPosted Aug 31, 2013, 7:00 AM
why occurring like this?
Sanjeeb LenkaPosted Aug 31, 2013, 6:41 AM
plz provide tbl_Customer table column names.
Abhishek JainPosted Aug 31, 2013, 6:41 AM
I can't see any such column "Name" in your database. Modify your Query like this:
Select
*, (FirstName + ' ' + LastName) AS Name
FROM
The DataField column name in your ASPX for every BoundField should be same as your column names, that is why you are getting this error.
Regards
AJ
Bineesh ViswanathPosted Aug 31, 2013, 6:31 AM
Width="100%">
Sanjeeb LenkaPosted Aug 31, 2013, 6:07 AM
as your error says there is field Name which is not present in datatable column what you have bind. plz check the column name with your grid column .if you are not getting share your grid aspx code.
Bineesh ViswanathPosted Aug 31, 2013, 6:02 AM
But you can see the GridFill function showing a error. I can't find out from where it is.
so help me in this topic.
Sanjeeb LenkaPosted Aug 31, 2013, 5:54 AM
Directly execute this query and check it retriving all data or not
SELECT *
FROM tbl_Customer