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
Naeem Khan
976
802
799.1k
How to fill datagridview row by row in c# using barcode
Jul 20 2015 4:23 AM
Hi,
I have a windows application developed in c#.
I have datagridview with three columns in it.
I will be scanning barcode in the text box.After scanning a particular barcode, i need to query the database and fill the barcodes info in the datagridview columns of the current row.
Like wise after scanning each barcode i need to fill the particular row like above.
i used this kind of code but its not working ..
try
{
MySqlConnection con = new MySqlConnection(StartUp.database);
con.Open();
MySqlCommand cmd = new MySqlCommand("select Accession_no,Title_in_full from t_book_details where Accession_no ='" + txt_accession_no.Text + "'", con);
MySqlDataReader dr = cmd.ExecuteReader();
if (dr.HasRows)
{
dr.Read();
gv_show_details.Rows[0].Cells[0].Value = dr[0].ToString();
gv_show_details.Rows[0].Cells[1].Value = dr[1].ToString();
gv_show_details.Rows.Add(dr);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
please give me idea where i m doing mistakes..
thanks in advance
Reply
Answers (
4
)
To copy files from one location to shared location using C#
Merging several text files into a text with order