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
Meena S
NA
48
4.4k
display data to datagridview from database
Jun 6 2019 9:36 AM
When am trying to display data to datagridview from database, only first row inserted properly
please find the below code. please correct the below code
public
void
filldata(String bno)
{
textBox1.Text = bno;
OleDbConnection con =
new
OleDbConnection(@
"Provider=SQLOLEDB;Data Source=DESKTOP\SQLEXPRESS;User ID=sa; Password = REGENT; Initial Catalog=Meena; Integrated secutity=SSPI"
);
con.Open();
OleDbCommand cmd =
new
OleDbCommand((
"Select * from data1 where Sno = '"
+bno +
"'"
), con);
OleDbDataAdapter da =
new
OleDbDataAdapter();
da.SelectCommand = cmd;
DataTable dt =
new
DataTable();
da.Fill(dt);
dataGridView1.AutoGenerateColumns =
false
;
dataGridView1.DataSource = dt;
dataGridView1.Columns[1].DataPropertyName =
"Itemcode"
;
dataGridView1.Columns[2].DataPropertyName =
"Description"
;
dataGridView1.Columns[3].DataPropertyName =
"Uom"
;
dataGridView1.Columns[4].DataPropertyName =
"Qunatity"
;
dataGridView1.Columns[5].DataPropertyName =
"Rate"
;
dataGridView1.Columns[6].DataPropertyName =
"Amount"
;
con.Close();
}
In the above picture, three fields not filled in datagrid. How to resolve this issue.
Reply
Answers (
9
)
After XSD TO CS Converted Facing Some Error Can Any One Help
canceling statement due to user request