Hi,
I want to pass DataGridView cell values from one page to another.Here the DataGridView is binding from Data Base using joins.My Table consists of 10 columns but I want to Bind only 5 columns to the DGV and when I double click on cell in DGV,based on Id I want to get all values to the TextBoxes(5 cell values from DGV and 5 columns from Data Base). I am getting 5 values from DGV but How to get remaining 5 values from Data Base.
How to solve this problem??Thanks as Advance...

Senthil KiumarPosted Oct 7, 2015, 4:28 AM
Vipan SharmaPosted Sep 3, 2015, 2:00 AM
Karthikeyan KPosted Sep 3, 2015, 1:25 AM
string conString = "Data Source=localhost;Initial Catalog=LoginScreen;Integrated Security=True";
SqlConnection con = new SqlConnection(conString);
string selectSql = "select * from data_table";
SqlCommand com = new SqlCommand(selectSql, con);
try
{
con.Open();
using (SqlDataReader read = cmd.ExecuteReader())
{
while(reader.Read())
{
Value1.Text = (read["Value1"].ToString());
Value2.Text = (read["Value2"].ToString());
Value 3.Text = (read["Value3"].ToString());
Value 4.Text = (read["Value4"].ToString());
Value 5.Text = (read["Value5"].ToString()); }
}
}
finally
{
con.Close();
}
If it is useful then accept my answer