TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
narasiman rao
NA
519
767.7k
i retrieved the column name from the data base to the DGV
Jan 9 2013 7:28 AM
i retrieved the column name from the data base to the data grid view.
design as follows at run time in data grid view ;
Date Session colname colname colname colname colname
7/1/12 1
7/1/12 2
7/1/12 3
7/1/12 4
7/1/12 5
in the run time in the column name faculty name is retrieved from the data base.that is working fine.
Here Total Column is 7.
Data base record as follows;
date session faculty name
7/1/12 1 G Sekar
7/1/12 2 R suresh
7/1/12 3 V Raju
7/1/12 4 m Murali
7/1/12 5 R Joshi
suppose when i add one record in the data base total record as follows;
date session faculty name
7/1/12 1 G Sekar
7/1/12 2 R suresh
7/1/12 3 V Raju
7/1/12 4 m Murali
7/1/12 5 R Joshi
8/1/12 1 R Ram
BUTTON CODE AS FOLLOWS;
con.Open();
SqlCommand cmd = new SqlCommand("select Faculty_Name from Tb_SCH_Faculty_Details Where Active <> 'D' ", con);
SqlDataReader dr = cmd.ExecuteReader();
int j = 2;
while (dr.Read())
{
datagridView.Columns[j].HeaderText = dr[0].ToString().Trim();
j++;
}
dr.Close();
con.Close();
that time when i click the BUTTON ERROR SHOWS AS FOLLOWS;
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name:
please help me.from the button code please correct it, i tried.
Reply
Answers (
3
)
crystal report application
Help me C#!