The simplest way to achieve that via
VBA code is to:
1. Create
ADODB.Connection[
^] to be able to connect to your database
2. Create
ADODB.Recordset[
^] to open it and grab/fetch data into it
3. Use
Range.CopyFromRecordset[
^] method in Excel to copy data from recordset object
In C# or VB.NET - the way to achieve that is bit different...
Without specific details, i can't help you more.