Ejemplo n.º 1
0
        public static void vernieuwContactInfo(Contact info)
        {
            SqlConnection connection = DALConnection.GetConnectionByName("Writer");

            //update user info, creating the query
            string     sqlQuery = "UPDATE ContactInfo SET PersoonId = @PersoonId, Straat = @Straat, Huisnummer = @Huisnummer, Huisnummertoevoeging = @Huisnummertoevoeging, Plaats = @Plaats, Postcode = @Postcode, Email = @Email, Telefoon = @Telefoon WHERE ContactInfoId = @ContactInfoId";
            SqlCommand command  = new SqlCommand(sqlQuery, connection);


            //replace parameters by values
            command.Parameters.AddWithValue("PersoonId", info.Persoonid);
            command.Parameters.AddWithValue("Straat", info.Straat);
            command.Parameters.AddWithValue("Huisnummer", info.Huisnummer);
            command.Parameters.AddWithValue("Huisnummertoevoeging", info.Huisnummertoevoeging);
            command.Parameters.AddWithValue("Plaats", info.Plaats);
            command.Parameters.AddWithValue("Postcode", info.Postcode);
            command.Parameters.AddWithValue("Email", info.Email);
            command.Parameters.AddWithValue("Telefoon", info.Telefoon);
            command.Parameters.AddWithValue("ContactInfoId", info.Id);
            command.ExecuteNonQuery();
            //close connection

            DALConnection.CloseSqlConnection(connection);
        }