You can write an ActiveX dll that includes a class module. This project will have a reference to Microsoft ActiveX Data Objects, and will use ADO to connect to the database. This class module may return data from database in various formats, which can be ADO Recordsets, scalar values or custom-defined objects.
For more information, refer to the MSDN. Duwamish Books sample in MSDN will be an excellent guide in this matter.
Mohammad Mehran Nikoo, MCP
mohmehran@yahoo.com