Posted on: 6/7/2013 11:47:17 AM | Views : 371

Dear Friends,
            The row values of one table is column values of another table. Then i will select the row name from the one table, insert to column name in another table. For that i am using foreach loop. While doing that what problem occuring means each data has stored in separete row instead of storing in single row.
My code is,
protected void Button2_Click(object sender, EventArgs e) { conn.Open(); SqlCommand cmd1 = conn.CreateCommand(); cmd1.CommandText = "SP_SELECT"; cmd1.CommandType = CommandType.StoredProcedure; SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = cmd1; DataTable dt = new DataTable(); da.Fill(dt); if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { string i = dr["Label_Name"].ToString(); conn.Close(); object ObjCtrl = new object(); ObjCtrl = PlaceHolder1.FindControl(i); Go to the complete details ...