Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Compare And copy data

Compare And copy data

Scheduled Pinned Locked Moved Visual Basic
testingbeta-testing
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    zzsoulzz
    wrote on last edited by
    #1

    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

    J 1 Reply Last reply
    0
    • Z zzsoulzz

      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

      J Offline
      J Offline
      just3ala2
      wrote on last edited by
      #2

      Use the objDataSet.Tables(0).Select("ColumnName = "& YourTextBox.Text") This will return DataRow Collection that you can manage the way you wish

      Best Regards 3ala2 :)

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups