Compare And copy data
-
Hi, I am now working on a data compare and copy for datagrid. Below i have the codes the open up this csv file and attached it to the datagrid1. I am now finding a way to 1. Type in "123123" into the textbox 2. Click a button 3. Compare it with the datagrid1(which has the opened csv file) or compare directly with csv file 4. Copy the whole row on which the "123123" is found and paste into another field or datagrid for display
Public Function Import() Dim myPath As String = "c:\testing.csv" Try Dim objDataSet As System.Data.DataSet Dim objAdapter As System.Data.OleDb.OleDbDataAdapter strConnection = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source='" & myPath & " '; " & "Extended Properties=Excel 8.0;") objAdapter = New System.Data.OleDb.OleDbDataAdapter("select * from [sheet1$]", strConnection) objDataSet = New System.Data.DataSet objAdapter.Fill(objDataSet) DataGrid1.DataSource = objDataSet.Tables(0).DefaultView strConnection.Close() Catch ex As Exception Dim er As String strConnection.Close() End Try
thanks -
Hi, I am now working on a data compare and copy for datagrid. Below i have the codes the open up this csv file and attached it to the datagrid1. I am now finding a way to 1. Type in "123123" into the textbox 2. Click a button 3. Compare it with the datagrid1(which has the opened csv file) or compare directly with csv file 4. Copy the whole row on which the "123123" is found and paste into another field or datagrid for display
Public Function Import() Dim myPath As String = "c:\testing.csv" Try Dim objDataSet As System.Data.DataSet Dim objAdapter As System.Data.OleDb.OleDbDataAdapter strConnection = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source='" & myPath & " '; " & "Extended Properties=Excel 8.0;") objAdapter = New System.Data.OleDb.OleDbDataAdapter("select * from [sheet1$]", strConnection) objDataSet = New System.Data.DataSet objAdapter.Fill(objDataSet) DataGrid1.DataSource = objDataSet.Tables(0).DefaultView strConnection.Close() Catch ex As Exception Dim er As String strConnection.Close() End Try
thanks