Here is the code: protected void postBtn_Click(object sender, EventArgs e) { SqlDataSource PostDS = new SqlDataSource(); System.Web.UI.WebControls.TextBox PostText = (System.Web.UI.WebControls.TextBox)DataList1.FindControl("postComment"); PostDS.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString(); PostDS.InsertCommandType = SqlDataSourceCommandType.Text; PostDS.InsertCommand = "INSERT INTO GroupChalkboard (Text, GroupID, UserID, CreatedDate) VALUES (@Text, @GroupID, @UserID, @CreatedDate)"; PostDS.InsertParameters.Add("Text", PostText.Text); PostDS.InsertParameters.Add("GroupID", pid.ToString()); PostDS.InsertParameters.Add("UserID", Session["UserID"].ToString()); PostDS.InsertParameters.Add("CreatedDate", DateTime.Now.ToString()); PostDS.Insert(); }