I am developing an application in C# VS 2010.
I have below code to fetch the student details with some name into the datagridview.
var CommandText = @"SELECT sid as 'Student ID', name as 'Student Name', adDate as
'Admission Date',
paidFees as 'Fees Paid', balance as 'Fees Remaining'
FROM Student WHERE (status = '" + status + "') AND
(name LIKE '%'+'"+txtSearchName.Text.Trim() + "'+'%')";
string select = CommandText;
con.Open();
SqlDataAdapter dataAdapter = new SqlDataAdapter(select, con);
SqlCommandBuilder commandBuilder = new SqlCommandBuilder(dataAdapter);
DataSet ds = new DataSet();
dataAdapter.Fill(ds);
con.Close();
dgvSearch.ReadOnly = true;
dgvSearch.DataSource = ds.Tables[0];
My problem is I am just getting headers of the table not data like below screenshot.
What is be wrong here?