Changed database type from OLE to SQL

plus various little changes and one bug fix