Exemplo n.º 1
0
        protected void Button1_Click1(object sender, EventArgs e)
        {
            try
            {
                string DBHost     = "127.0.0.1";
                string DBName     = "base";
                string DBUserName = "******";
                string DBPassword = "******";

                string Conn_String = "server=" + DBHost + ";uid=" + DBUserName + ";password="******";database=" + DBName + ";";


                MySqlConnection Conn = new MySqlConnection(Conn_String);
                Conn.Open();

                name  = DropDownList1.Text;
                topic = TextBox2.Text;
                dat   = TextBox3.ToString();
                MySqlCommand cmd;
                cmd = new MySqlCommand("insert into preacher(name,date,topic) values('" + DropDownList1.Text + "','" + TextBox3.Text + "','" + TextBox2.Text + "')", Conn);
                cmd.ExecuteNonQuery();
                Conn.Close();
            }

            catch (Exception ex)
            {
                Label1.Text = ex.ToString();
            }
            Calendar1.Visible = false;
        }