Пример #1
0
        public void Load_Frends()
        {
            string        strConn = ConfigurationManager.ConnectionStrings["PandaHelp"].ToString();
            SqlConnection conn    = new SqlConnection(strConn);
            SqlCommand    cmd     = new SqlCommand
                                        (" select Name,ProfilePic,u.UserProfileID from UserProfile u inner join Chat c on u.UserProfileID = c.UserProfileID2 where c.UserProfileID1 !=@id;", conn);
            SqlCommand cmd2 = new SqlCommand
                                  (" select Name,ProfilePic,u.UserProfileID from UserProfile u inner join Chat c on u.UserProfileID = c.UserProfileID1 where c.UserProfileID2 !=@id;", conn);

            cmd.Parameters.AddWithValue("@id", c.TutorID);
            cmd2.Parameters.AddWithValue("@id", c.TutorID);
            SqlDataAdapter da  = new SqlDataAdapter(cmd);
            SqlDataAdapter da2 = new SqlDataAdapter(cmd2);
            DataSet        ds  = new DataSet();

            conn.Open();
            da.Fill(ds, "Chattitle");
            da2.Fill(ds, "Recipent");
            conn.Close();
            DataTable dtblFinal = new DataTable();

            foreach (DataTable table in ds.Tables)
            {
                dtblFinal.Merge(table, false, MissingSchemaAction.Add);
            }
            //DataList2.DataSource = ds;
            //DataList2.DataBind();
            Inbox.DataSource = dtblFinal;
            Inbox.DataBind();
        }