Last post Aug 21, 2010 03:26 PM by vinay13mar
None
0 Points
1 Post
Aug 21, 2010 01:06 PM|asiddle423|LINK
Hi
I was wondering how to recieve an individual field from my MySQL database.
I have been able to get a row, but what I am trying to do is get a name from my database and set it into the HeaderText in my DataGrid.
The way I am trying to do it at the moment is
using (OdbcCommand cmd = new OdbcCommand(formQuery, con)) { con.Open(); formDataGrid.Columns[0].HeaderText = cmd.ExecuteReader( CommandBehavior.CloseConnection | CommandBehavior.SingleResult).GetValue(0); }
This doesn't seem to get a value from the GetValue, but if use
using (OdbcCommand cmd = new OdbcCommand(formQuery, con)) { con.Open(); formDataGrid.DataSource = cmd.ExecuteReader( CommandBehavior.CloseConnection | CommandBehavior.SingleResult); formDataGrid.DataBind(); }
it will bind my data into the grid.
I just want to be able to change the HeaderText in the first coulmn of the DataGrid from one table and have the DataGrid be filled from another table.
I can fill the DataGrid its just changing the HeaderText that I am having trouble with.
Any help?
Thanks in advance
Contributor
5745 Points
1899 Posts
Aug 21, 2010 03:26 PM|vinay13mar|LINK
Hi,
plz check the link this will help u:
http://stackoverflow.com/questions/2748108/repeater-and-add-columns-to-header-and-itemtemplate-on-page-load
None
0 Points
1 Post
Individual field - MySQL
Aug 21, 2010 01:06 PM|asiddle423|LINK
Hi
I was wondering how to recieve an individual field from my MySQL database.
I have been able to get a row, but what I am trying to do is get a name from my database and set it into the HeaderText in my DataGrid.
The way I am trying to do it at the moment is
This doesn't seem to get a value from the GetValue, but if use
it will bind my data into the grid.
I just want to be able to change the HeaderText in the first coulmn of the DataGrid from one table and have the DataGrid be filled from another table.
I can fill the DataGrid its just changing the HeaderText that I am having trouble with.
Any help?
Thanks in advance
Contributor
5745 Points
1899 Posts
Re: Individual field - MySQL
Aug 21, 2010 03:26 PM|vinay13mar|LINK
Hi,
plz check the link this will help u:
http://stackoverflow.com/questions/2748108/repeater-and-add-columns-to-header-and-itemtemplate-on-page-load
V.K.Singh