Exemplo n.º 1
0
        public void updateBillByID(int id)
        {
            string        connectionString = @"Data Source=cdb.c1lbyzt9l8fn.us-west-2.rds.amazonaws.com,1433;" + "Initial Catalog=cis;" + "User id=sonaaaa;" + "Password=mo7senzzzz;";
            SqlConnection myConnection     = new SqlConnection(connectionString);
            bill          bill             = new bill();

            myConnection.Open();
            SqlCommand myCommand = new SqlCommand();

            myCommand.CommandText = "UPDATE bill SET id =" + id + ",billNumber ='" + bill.getBillNumber().ToString() + "',date ='" + bill.getBDate() + "', value ='" + bill.getValue().ToString() + "', paid = '" + bill.getPaid().ToString() + "' WHERE ID = " + id + ";";
            myCommand.Connection  = myConnection;
            myCommand.ExecuteNonQuery();
            myConnection.Close();
        }
Exemplo n.º 2
0
        public void insertBill(bill bill)
        {
            string        connectionString = @"Data Source=cdb.c1lbyzt9l8fn.us-west-2.rds.amazonaws.com,1433;" + "Initial Catalog=cis;" + "User id=sonaaaa;" + "Password=mo7senzzzz;";
            SqlConnection myConnection     = new SqlConnection(connectionString);

            myConnection.Open();
            SqlCommand myCommand = new SqlCommand();

            myCommand.CommandText = "insert into bill (id,date,value,paid) Values ('" + bill.getID().ToString() + "','" + bill.getBDate() + "','" + bill.getValue() + "','" + bill.getPaid() + "')  ;  ";
            myCommand.Connection  = myConnection;
            myCommand.ExecuteNonQuery();
            myConnection.Close();
        }