J
Jeff
IDE: Visual Studio 2003 .NET
OS: XP Pro
SqlCommand cmd = sqlCon.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "select OrderID from Orders";
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
adapter.SelectCommand = cmd;
DataSet dsResult = new DataSet();
adapter.Fill(dsResult);
DataGridTableStyle tsl = new DataGridTableStyle();
DataGridColumnStyle testCol = new DataGridTextBoxColumn();
testCol.MappingName = "OrderID";
testCol.HeaderText = "Hello world";
testCol.Width = 150;
tsl.GridColumnStyles.Add(testCol);
dataGrid1.TableStyles.Add(tsl);
dataGrid1.DataSource = dsResult;
dataGrid1.DataMember = "Table";
When I run this script the columntext is OrderID, I thought it should be
"Hello world". What did I wrong here??
Regards
Jeff
OS: XP Pro
SqlCommand cmd = sqlCon.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "select OrderID from Orders";
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
adapter.SelectCommand = cmd;
DataSet dsResult = new DataSet();
adapter.Fill(dsResult);
DataGridTableStyle tsl = new DataGridTableStyle();
DataGridColumnStyle testCol = new DataGridTextBoxColumn();
testCol.MappingName = "OrderID";
testCol.HeaderText = "Hello world";
testCol.Width = 150;
tsl.GridColumnStyles.Add(testCol);
dataGrid1.TableStyles.Add(tsl);
dataGrid1.DataSource = dsResult;
dataGrid1.DataMember = "Table";
When I run this script the columntext is OrderID, I thought it should be
"Hello world". What did I wrong here??
Regards
Jeff