Convert mssql cartridge to C#