コード例 #1
0
        public void LoadChatbox()
        {
            string        strConn = ConfigurationManager.ConnectionStrings["PandaHelp"].ToString();
            SqlConnection conn    = new SqlConnection(strConn);
            SqlCommand    cmd     = new SqlCommand
                                        ("select * from Message where ChatID=@chat ORDER BY MessageID;", conn);

            cmd.Parameters.AddWithValue("@chat", c.ChatID);
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            DataSet        ds = new DataSet();

            conn.Open();
            da.Fill(ds);
            conn.Close();
            //DataList2.DataSource = ds;
            //DataList2.DataBind();
            ChatBox.DataSource = ds;
            ChatBox.DataBind();

            //ScriptManager.RegisterStartupScript(this.Page, typeof(Panel), "PanelChatContent", ";ScrollToBottom();", true);
        }