コード例 #1
0
        private void Add_Click(object sender, EventArgs e)
        {
            using (SqlConnection Conect = new SqlConnection(@"Data Source=DESKTOP-78L61PQ\SQLEXPRESS;
            Initial Catalog=Sistema de Prestamos; Integrated Security=True;"))
            {
                int    Id;
                int    Quant;
                double Interest;
                int    Quotes;

                Id       = int.Parse(ClientId.Text);
                Quant    = int.Parse(Quantity.Text);
                Interest = int.Parse(InterestRate.Text);
                Quotes   = int.Parse(Quote.Text);


                Conect.Open();
                SqlCommand cmd = new SqlCommand("GenerateLoans", Conect);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@ClientId", Id);
                cmd.Parameters.AddWithValue("@Amount", Quant);
                cmd.Parameters.AddWithValue("@InterestRate", Interest);
                cmd.Parameters.AddWithValue("@feesamount", Quotes);
                cmd.ExecuteNonQuery();
                ClientId.Clear();
                Quantity.Clear();
                InterestRate.Clear();
                Quote.Clear();
                this.Hide();
            }
        }