I have one datagrid and I want to show three column using it. I have used stored procedure to show some records into datagrid.
stored procedure is :
procedure [dbo].[allKeys]
AS
select id,key,username from keys_TB
the key in this procedure is encrypted so, need to convert it i have done that conversion and have keep those key is ArrayList.
But problem is have bind the remaining id,username columns to datagrid, unable to bind ArrayList to datagrid.
Code behind :
DataSet ds = clsBusinessLogic.allKeys();
dgrv_allkey.DataSource = ds.Tables[0];
dgrv_allkey.AutoGenerateColumns = false;
dgrv_allkey.Columns["id"].DataPropertyName = "id";
DataGridViewColumn id = dgrv_allkey.Columns[0];
this.dgrv_allkey.Columns[0].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
id.Width = 60;
dgrv_allkey.Columns["username"].DataPropertyName = "username";
DataGridViewColumn Custname = dgrv_allkey.Columns[2];
Custname.Width = 199;
this.dgrv_allkey.Columns[2].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
this is how i have bind id and username to datagrid but don't have any clue about key.
and i have called the stored procedure [allKeys] through clsBusinessLogic.allKeys() method