title: How to create an Excel file using a database query in VB.Net?
body: <p>I would like to generate an Excel file using a database query in VB.Net. How can I do it? </p>
  
  <p>To be more precise: I would like to "bind" a query (much like binding a query to a GridView) to an Excel file such that the rows in the table occupy corresponding cells in a new Excel file, and save the file to my computer. And then, mail that file to someone.</p>
  
  <p>While I can handle the mailing part, it's the creation of such a file that I need help with. Anyone know how to achieve what I want to achieve?</p>
  
  <p>PS: I need to do this in VB.Net and I'm using SQL Server 2008.</p>