Ashwin Kumar

Ashwin Kumar

  • NA
  • 1
  • 612

creating dynamic label in array and retriving data from data

Aug 24 2015 7:44 AM
hi... here is my code

d=25;
Label[] lb1 = new Label[d];
string strd = "select monthly from feehead where fee_head='" + lb.Text + "'";
da = new SqlDataAdapter(strd, con);
DataSet ds11 = new DataSet();
da.Fill(ds11);
for (int l = 1; l < d; l++)
{
lb1[l].Text = ds11.Tables[0].Rows[0][0].ToString();
}
 
 
database is:
Hide Copy Code
CREATE TABLE [FEEHEAD] (     [ACT_CODE] [int] NULL ,     [FEE_HEAD] [nvarchar] (25) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,     [MONTHLY] [bit] NOT NULL ,     [CL_BASED] [bit] NOT NULL ,     [AMOUNT] [float] NULL ,     [SHNAME] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,     [EMP] [float] NULL ,     [CCL] [float] NULL ,     [SPL] [float] NULL ,     [EXT] [float] NULL ,     [AccG] [int] NULL ,     [HType] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,     [APR] [bit] NOT NULL ,     [may] [bit] NOT NULL ,     [JUN] [bit] NOT NULL ,     [JUL] [bit] NOT NULL ,     [AUG] [bit] NOT NULL ,     [SEP] [bit] NOT NULL ,     [OCT] [bit] NOT NULL ,     [NOV] [bit] NOT NULL ,     [DECM] [bit] NOT NULL ,     [JAN] [bit] NOT NULL ,     [FEB] [bit] NOT NULL ,     [MAR] [bit] NOT NULL ) ON [PRIMARY] GO 



and my error is:
Object reference not set to an instance of an object. 

Answers (1)