Results 1 to 2 of 2

Thread: Text File, Datagird, SQL [Resolved]

  1. #1

    Thread Starter
    Addicted Member rdove's Avatar
    Join Date
    Dec 2002
    Location
    Indianapolis
    Posts
    251

    Text File, Datagird, SQL [Resolved]

    I am trying to write a program that pulls information from a text file, much like a database. I have no problem getting the data and populating a dataset.

    What I am attempting to do is send a WHERE clause in my SQL statement to look for certain values in a CSV column, much like you would in a database, but I can't seem to figure it out. Any ideas?

    VB Code:
    1. strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    2.         "Data Source=" & Path & ";Extended Properties=Text;"
    3.  
    4.         SQL = "SELECT * FROM " & FileName
    5.  
    6.         ds = GetDataSet(SQL, strConn)
    7.         DataGrid1.DataSource = ds
    8.         DataGrid1.DataMember = "Table"
    9.  
    10.     Public Shared Function GetDataSet( _
    11.          ByVal SQLString As String, _
    12.          ByVal ConnectionString As String) As DataSet
    13.  
    14.         Dim da As OleDbDataAdapter
    15.         Dim ds As DataSet
    16.  
    17.         Try
    18.             ' Create new DataAdapter
    19.             da = New OleDbDataAdapter( _
    20.                 SQLString, ConnectionString)
    21.  
    22.             ' Fill DataSet from DataAdapter
    23.             ds = New DataSet()
    24.             da.Fill(ds)
    25.  
    26.         Catch
    27.  
    28.         End Try
    29.  
    30.         Return ds
    31.     End Function
    Last edited by rdove; May 19th, 2003 at 10:53 AM.
    ~Ryan





    Have I helped you? Please Rate my posts.

  2. #2

    Thread Starter
    Addicted Member rdove's Avatar
    Join Date
    Dec 2002
    Location
    Indianapolis
    Posts
    251
    My ignorance was the problem. I finally remembered I could use a datareader and specify field indexs i.e. dr(3).ToString to get the values.

    Thanks anyways
    ~Ryan





    Have I helped you? Please Rate my posts.

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