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 LenkaRank #301 · 8.3K reputationPosted Aug 31, 2013, 3:07 AM EDT
try this
Width="100%">
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Aug 31, 2013, 1:54 AM EDT
Directly execute this query and check it retriving all data or not
SELECT *
FROM tbl_Customer
Bineesh ViswanathRank #1,680 · 907 reputationPosted Aug 31, 2013, 2:02 AM EDT
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 LenkaRank #301 · 8.3K reputationPosted Aug 31, 2013, 2:07 AM EDT
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 ViswanathRank #1,680 · 907 reputationPosted Aug 31, 2013, 2:31 AM EDT
Width="100%">
Abhishek JainRank #1,062 · 1.8K reputationPosted Aug 31, 2013, 2:41 AM EDT
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
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Aug 31, 2013, 2:41 AM EDT
plz provide tbl_Customer table column names.
Bineesh ViswanathRank #1,680 · 907 reputationPosted Aug 31, 2013, 3:00 AM EDT
why occurring like this?
Bineesh ViswanathRank #1,680 · 907 reputationPosted Aug 31, 2013, 3:04 AM EDT
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Aug 31, 2013, 3:04 AM EDT
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.
Abhishek JainRank #1,062 · 1.8K reputationPosted Aug 31, 2013, 3:08 AM EDT
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
Ramakrishna PathuriRank #2,431 · 580 reputationPosted Aug 31, 2013, 3:20 AM EDT
Bineesh ViswanathRank #1,680 · 907 reputationPosted Aug 31, 2013, 3:24 AM EDT