¤ i whould u like to import data from sql server database into excel
¤ sheet using vb.net
Below is one method you can use:
Dim ExcelConnection As New
System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & "c:\Test
Files\ExcelWB.xls" & ";" & _
"Extended Properties=Excel
8.0;")
ExcelConnection.Open()
Dim ExcelCommand As New System.Data.OleDb.OleDbCommand("SELECT * INTO [Orders] FROM [Orders]
IN '' [ODBC;Driver={SQL Server};Server=(local);Database=Northwind;Trusted_Connection=yes];",
ExcelConnection)
ExcelCommand.ExecuteNonQuery()
ExcelConnection.Close()
Paul
~~~~
Microsoft MVP (Visual Basic)