Dim mstrExcelQuery As String Dim commExcel As New SqlCommand conn = New SqlConnection("Data Source=MIL-Dev2-PC;Initial Catalog=meridian;User Id=sa;Password=master") conn.Open() mstrExcelQuery = "SELECT * INTO [Excel 8.0;DATABASE=" & strExcelFile & _ "].[" & strWorksheet & "] FROM " & "[" & FinalQuery & "]" commExcel = New SqlCommand(mstrExcelQuery, conn) commExcel.ExecuteNonQuery() commExcel.Dispose() conn.Close() SaveFileDialog1.Dispose() MsgBox("Report Saved to Excel!!", MsgBoxStyle.Information)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)