Changed to using datatype converters for setting parameters in SQL statements. With tests