Reputation: 119
I only want data not header column names from the DataTable result set. or is it possible to create a DataTable without column headers. i tried every possible scenario but couldn't get anything. above
Is my sp result, which I can very easily convert into DataTable. But I don't want to header row. there is option in SQL where we can include or exclude the column headers but even that is not working
Your help is highly appreciated.
this is my test c# code
DataTable table = new DataTable();
SqlCommand cmd = new SqlCommand("Rmtest1", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@unitName", SqlDbType.VarChar).Value = unitName;
cmd.Parameters.Add("@startdate", SqlDbType.VarChar).Value = startDate;
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(table);
So basically I want the rows but not the headers
Upvotes: 0
Views: 7031
Reputation: 797
You can't hide column header from DataTable. But you can hide it from your displaying control. I'm not sure which control you want to use for your case, but you can use the following code to hide it from DataGridView in WinForm App.
dgwStudents.ColumnHeadersVisible = false;
Upvotes: 0
Reputation: 57
As far as I know, you cant hide/remove the column header, but you can change the column header name with some string space (" ") to make the column header looks like blank.
Upvotes: 1