private void loadPaymentRecords() { SQLCon.sqlDataAdapter = new SqlDataAdapter("SELECT PolicyNumberPayment AS [POLICY NO], PaidDate AS [DATE PAID], PaymentPaid AS [PAYMENT PAID] FROM PaymentRecords WHERE PolicyNumberPayment='" + dataGridView1.SelectedRows[0].Cells[1].Value.ToString() + "'", SQLCon.sqlConnection); //SQLCon.sqlDataAdapter.SelectCommand.Parameters.AddWithValue("@1", "%" + lb_PolicyNo.Text + "%"); SQLCon.dbCon(); SQLCon.dataTable = new DataTable(); SQLCon.sqlDataAdapter.Fill(SQLCon.dataTable); dataGridView_PaymentRecordss.DataSource = SQLCon.dataTable; }
private void AddPayment() { SQLCon.dbCon(); SQLCon.sqlCommand = new SqlCommand("INSERT INTO PaymentRecords VALUES (@2, @3, @4)", SQLCon.sqlConnection); SQLCon.sqlCommand.CommandType = CommandType.Text; SQLCon.sqlCommand.Parameters.AddWithValue("@2", Int32.Parse(lb_SumInsurred.Text)); SQLCon.sqlCommand.Parameters.AddWithValue("@3", DateTime.Now.ToString()); SQLCon.sqlCommand.Parameters.AddWithValue("@4", lb_PolicyNo.Text); SQLCon.sqlCommand.ExecuteNonQuery(); }
private void Login_Load(object sender, EventArgs e) { SQLCon.dbCon(); }