I am working on a .NET project where I am trying to change the column heading names in datagridview but for unknown reason I am still unable to do so . Can anyone help me out in this matter
Below is the code and markup for the datagridview that I am using :
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.Location = new System.Drawing.Point(539, 36);
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.RowHeadersWidth = 51;
this.dataGridView1.RowTemplate.Height = 24;
this.dataGridView1.Size = new System.Drawing.Size(936, 353);
this.dataGridView1.TabIndex = 9;
code :
string query = "SELECT $_LastSaleDate AS 'Last_Sale_Date', $_LastSaleParty AS 'last sale to party', $_LastSalePrice AS 'last sold price', $Name AS 'name of party', $_ClosingBalance AS 'closing balance' FROM ItemMovementAnalysis WHERE ($_ClosingBalance = 1511) AND ($_LastSalePrice = 25) AND ($_LastSaleParty = 'Sumandeep Ji ( Punjab )') and ($_LastSaleDate = '09 Aug 2022') ";
using (OdbcDataAdapter dadapter = new OdbcDataAdapter(query, con))
{
DataTable table = new DataTable();
dadapter.Fill(table);
this.dataGridView1.DataSource = table;
}