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.3k
how to fill database and textbox value same row datagrid
May 10 2019 1:01 AM
I want to fill first 3 columns based on combobox select other 2 columns from textbox values
I done code in combobox seletectedindexchanged event. but it fills data to next row
private
void
comboBox3_SelectedIndexChanged(
object
sender, EventArgs e)
{
OleDbConnection con =
new
OleDbConnection(@
"Provider=SQLOLEDB;Data Source=DESKTOP\SQLEXPRESS;User ID=sa; Password = REGENT; Initial Catalog=Meena; Integrated secutity=SSPI"
);
DataSet ds =
new
DataSet();
DataTable dt =
new
DataTable();
con.Open();
OleDbCommand cmd =
new
OleDbCommand((
"Select t1.itemcode, t2.Description, t1.UOM from Item t1 INNER JOIN ItemGroup t2 ON t1.Itemcode = '"
+ comboBox3.Text +
"'"
), con);
OleDbDataAdapter da =
new
OleDbDataAdapter();
da.SelectCommand = cmd;
DataRow dr = dt.NewRow();
da.Fill(dt);
dt.Columns.Add(
"Quantity"
);
dt.Columns.Add(
"Rate"
);
dt.Columns.Add(
"Amount"
);
dr[3] = textBox3.Text;
dr[4] = textBox5.Text;
dt.Rows.Add(dr);
if
(dt.Rows.Count > 0)
{
dataGridView1.DataSource = dt;
}
}
Reply
Answers (
1
)
how can i read identification of my processor
How to change pnrp.net peer name resolver to custom domain?