Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (textBox1.Text != null & textBox3.Text == "AsFCDF1Q3QWSW9fsFS0fd3vF7i29H")
                {
                    this.Visible = false;
                    login l = new login();

                    l.Show();


                    string str1 = "";
                    str1 = ConfigurationManager.ConnectionStrings["cn1"].ConnectionString;
                    SqlConnection CN = new SqlConnection(str1);

                    string qry = "insert into ser(Name_Company) values(@c1)";



                    SqlCommand SqlCom = new SqlCommand(qry, CN);

                    SqlCom.Parameters.Add(new SqlParameter("@c1", (object)textBox1.Text));


                    CN.Open();

                    SqlCom.ExecuteNonQuery();

                    CN.Close();
                }
            }
            catch (Exception er)
            {
                MsgBox.ShowMessage(this.Handle.ToInt32(), er.Message.ToString(), " خطا ", "تایید", "", "", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign);
            }
        }