Results 1 to 2 of 2

Thread: Help

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2018
    Posts
    13

    Help

    Hi,

    I am working in reconciliation project while uses multiple text file .

    Currently i completed one step in this project and retrieve the text file in data table and data grid .

    I have a problem with link database with VB.net and append all data in text files in database tables .

    Any help please

    Here is the code

    Code:
    Public Class Form1
        Dim con As New OleDb.OleDbConnection
    
        Public Sub New()
    
            InitializeComponent()
    
            Dim scon As String = String.Empty, scom As String = String.Empty
            Dim con As OleDb.OleDbConnection = Nothing, com As OleDb.OleDbCommand = Nothing, rdr As OleDb.OleDbDataReader = Nothing
            Dim sFileName As String = String.Empty
            Dim dt As Data.DataTable = Nothing, r As DataRow = Nothing
            Try
    
                sFileName = "C:\test\record.txt"
                scon = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=" & IO.Path.GetDirectoryName(sFileName) & ";Extended Properties='Text;HDR=Yes;Schema=schema.ini;';"
                scom = "SELECT * FROM " & sFileName
                con = New OleDb.OleDbConnection(scon)
                con.Open()
                com = New OleDb.OleDbCommand(scom, con)
                rdr = com.ExecuteReader()
                dt = New Data.DataTable
                dt.Load(rdr)
    
                Me.DataGridView1.DataSource = dt
                TextBox1.Text = D
    
            Catch ex As Exception
                MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Error...")
            Finally
                rdr.Close()
                com.Dispose()
                con.Close()
                con.Dispose()
            End Try
    
        End Sub

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: Help

    Ok. That loads one text file into a datatable. You need to explain clearly how you want your text files to be loaded. Titles like 'Help' are useless. We know you need help, or you wouldn't be posting here. Similarly saying you want to append your textfiles is ambiguous. How exactly do you want to join your text files??? What do the text files contain???

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width