Tech
Forums
Jobs
Books
Events
Videos
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
0
Answer
show save record in datagridview in c# using windowsapplic
narasiman rao
11y
1.9k
1
Reply
Note it is windows application.
Run mode screen as follows;
Course Code Combo box
Datagridview as follows;
Days sess1 sess 2 sess3 sess4
1 checkbox checkbox checkbox checkbox
In Database record as follows;
course Code Days sess1 sess2 sess3 sess4
REO 1 checkboxchecked checkboxchecked checkboxchecked checkboxchecked
Then i have one button in the run mode called Search Button when click the REO Course in the combo box, in the datagridview that particular course details to be displayed in the datagridview.
For that search button code as follows;
int irow;
sql = "select [Days],[sess1],[sess2],[sess3],[sess14] from Tb_Session_Structure where Cmn_Minor_code = '" + cb_Course_Code.Text.ToString() + "'";
dr = GFun.ReadAcessSql(sql);
while (dr.Read())
{
for (irow = 0; irow < DGv_Session.RowCount; irow++)
{
DGv_Session.Rows[irow].Cells[0] = dr[0].ToString().Trim();
DGv_Session.Rows[irow].Cells[1] = dr[1].ToString().Trim();
DGv_Session.Rows[irow].Cells[2] = dr[2].ToString().Trim();
DGv_Session.Rows[irow].Cells[3] = dr[3].ToString().Trim();
dr.Close();
}
}
when i click the Search button error shows as follows;
Cannot implicitly convert type string to System.Windows.Forms.DataGridViewCell
what is the problem in my above code.
in the search button what is the mistake i made.
please help me.
Regards,
Rao
Post
Reset
Cancel
Answers (
0
)
Next Recommended Forum
Register Eventhandler`1 via late binding
Problem related mvc application