How to dump the filtered data from an excel file in Sql-server 2000
-
Respected Gurus I have an excel file which may contains more than 250000 records.I have to dump those reords in my database.I am able to do it,but its very very slow. I have to optimize it. For that i want to filter the records from excel file on the basis of a particular date. I want to give the user flexibility of choosing the date,for which he wants to dump the data.How can i do this?? My sample code is:---- Dim StrReportdate As String StrReportdate = Trim(txtDate.Value) If StrReportdate <> "" Then Dim culture = New CultureInfo("fr-FR", True) dtreportdate = DateTime.Parse(StrReportdate, culture, DateTimeStyles.None) End If Dim strConnectionString As String = String.Empty strConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strFilePath + ";Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1""" Dim cnCSV As New OleDbConnection(strConnectionString) cnCSV.Open() Dim cmdSelect As New OleDbCommand("SELECT * FROM [sheet1$] where F2=" & dtreportdate, cnCSV) 'Dim cmdSelect As New OleDbCommand("SELECT * FROM [Sheet2$]", cnCSV) Dim daCSV As New OleDbDataAdapter daCSV.SelectCommand = cmdSelect Dim ds As New DataSet daCSV.Fill(ds)