click on dtagridview display result in relative textbox
-
hi........ the code is con.ConnectionString = "Data Source=SPARK1\\SQLEXPRESS;Initial Catalog=Empdetails;Integrated security=true"; con.Open(); //int p = Convert.ToInt32(dataGridView1.SelectedRows); String s = "Select * from Empdetails where EmpId="; SqlCommand cmd = new SqlCommand(s, con); SqlDataReader dr = cmd.ExecuteReader(); //dataGridView1.DataSource = dr; //GridView1.DataBind(); while (dr.Read()) { txtempid.Text = dr.GetInt32(0).ToString(); txtname.Text = dr.GetValue(1).ToString(); txtaddress.Text = dr.GetValue(2).ToString(); combodes.Text = dr.GetValue(3).ToString(); txtphno.Text = dr.GetInt32(4).ToString(); } dr.Close(); cmd.ExecuteNonQuery(); con.Close(); }
-
hi........ the code is con.ConnectionString = "Data Source=SPARK1\\SQLEXPRESS;Initial Catalog=Empdetails;Integrated security=true"; con.Open(); //int p = Convert.ToInt32(dataGridView1.SelectedRows); String s = "Select * from Empdetails where EmpId="; SqlCommand cmd = new SqlCommand(s, con); SqlDataReader dr = cmd.ExecuteReader(); //dataGridView1.DataSource = dr; //GridView1.DataBind(); while (dr.Read()) { txtempid.Text = dr.GetInt32(0).ToString(); txtname.Text = dr.GetValue(1).ToString(); txtaddress.Text = dr.GetValue(2).ToString(); combodes.Text = dr.GetValue(3).ToString(); txtphno.Text = dr.GetInt32(4).ToString(); } dr.Close(); cmd.ExecuteNonQuery(); con.Close(); }
a) You've posted code, but not formatted it. in <pre> tags b) You haven't said what is or is not happening that needs to be fixed.
Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
-
a) You've posted code, but not formatted it. in <pre> tags b) You haven't said what is or is not happening that needs to be fixed.
Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
:thumbsup:
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
-
a) You've posted code, but not formatted it. in <pre> tags b) You haven't said what is or is not happening that needs to be fixed.
Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
hi......... the code is con.ConnectionString = "Data Source=SPARK1\\SQLEXPRESS;Initial Catalog=Empdetails;Integrated security=true"; con.Open(); //int p = Convert.ToInt32(dataGridView1.SelectedRows); String s = "Select * from Empdetails where EmpId="; SqlCommand cmd = new SqlCommand(s, con); SqlDataReader dr = cmd.ExecuteReader(); //dataGridView1.DataSource = dr; //GridView1.DataBind(); while (dr.Read()) { txtempid.Text = dr.GetInt32(0).ToString(); txtname.Text = dr.GetValue(1).ToString(); txtaddress.Text = dr.GetValue(2).ToString(); combodes.Text = dr.GetValue(3).ToString(); txtphno.Text = dr.GetInt32(4).ToString(); } dr.Close(); cmd.ExecuteNonQuery(); con.Close();
-
hi......... the code is con.ConnectionString = "Data Source=SPARK1\\SQLEXPRESS;Initial Catalog=Empdetails;Integrated security=true"; con.Open(); //int p = Convert.ToInt32(dataGridView1.SelectedRows); String s = "Select * from Empdetails where EmpId="; SqlCommand cmd = new SqlCommand(s, con); SqlDataReader dr = cmd.ExecuteReader(); //dataGridView1.DataSource = dr; //GridView1.DataBind(); while (dr.Read()) { txtempid.Text = dr.GetInt32(0).ToString(); txtname.Text = dr.GetValue(1).ToString(); txtaddress.Text = dr.GetValue(2).ToString(); combodes.Text = dr.GetValue(3).ToString(); txtphno.Text = dr.GetInt32(4).ToString(); } dr.Close(); cmd.ExecuteNonQuery(); con.Close();
Congratulations! You win the prize for posting the most useless post of the day! Exactly the same as the post you were criticised for, but missing one closing curly bracket! Well done - and thanks for listening! :-D
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
-
hi......... the code is con.ConnectionString = "Data Source=SPARK1\\SQLEXPRESS;Initial Catalog=Empdetails;Integrated security=true"; con.Open(); //int p = Convert.ToInt32(dataGridView1.SelectedRows); String s = "Select * from Empdetails where EmpId="; SqlCommand cmd = new SqlCommand(s, con); SqlDataReader dr = cmd.ExecuteReader(); //dataGridView1.DataSource = dr; //GridView1.DataBind(); while (dr.Read()) { txtempid.Text = dr.GetInt32(0).ToString(); txtname.Text = dr.GetValue(1).ToString(); txtaddress.Text = dr.GetValue(2).ToString(); combodes.Text = dr.GetValue(3).ToString(); txtphno.Text = dr.GetInt32(4).ToString(); } dr.Close(); cmd.ExecuteNonQuery(); con.Close();
you may not be the smartest guy in town, but at least you are consistent. :omg:
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.
-
you may not be the smartest guy in town, but at least you are consistent. :omg:
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.
"A foolish consistency is the hobgoblin of little minds" - R W Emerson. I think it applies quite well to this questioner. Judging by his other posts, he is trying to punch well above his programming weight...
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy