 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the WinForms/Console Application Design section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|

October 23rd, 2009, 08:31 AM
|
Friend of Wrox
|
|
Join Date: Mar 2007
Posts: 205
Thanks: 4
Thanked 0 Times in 0 Posts
|
|
Import .csv file and process
I need to write a windows app ( vb 2005) that does following:
1. Imports a .csv file
2. Selects certain rows from the .csv file
3. Splits the .csv file into fields based on delimiter
4. Populate a db2/400 table with only some of the fields.
Example of rows:
Code:
061000104,6607607911512,Pavex Corporation,20091005,100,33824.59,,,Total Credits
061000104,6607607911512,Pavex Corporation,20091005,400,33824.59,,,Total Debits
061000104,6607607911512,Pavex Corporation,20091005,478,33824.59,,,Total Cpr Paid Checks
061000104,6607607911512,Pavex Corporation,20091005,275,33824.59,ZBC0627008000093, ,ZBA Credit
061000104,6607607911512,Pavex Corporation,20091005,472,33824.59,SUDR000000000000, ,Debit For List Post Summary
061000104,6607607911512,Pavex Corporation,20091005,479,19935.00,CPRP0097280285I,53544,CPR Paid Check
061000104,6607607911512,Pavex Corporation,20091005,479,37.83,CPRP0095037189I,53550,CPR Paid Check
061000104,6607607911512,Pavex Corporation,20091005,479,575.00,CPRP0096056850I,53561,CPR Paid Check
Need to select only rows with "Paid Check". Field3, field4, field5, field6 and field7 only will be inserted into the db2/400 table.
Does anyone have code sample I could use? Thank you.
|

October 23rd, 2009, 08:45 AM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
|
|
Hello...
Google is your friend (and usually faster that us)...
Try: import cvs file and parse vb.net
Lot's of links (code, libraries and others!!) If you have any question about what you found, ask again.
__________________
HTH
Gonzalo
================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the proof.
================================================== =========
|
The Following User Says Thank You to gbianchi For This Useful Post:
|
|

October 23rd, 2009, 09:47 AM
|
Friend of Wrox
|
|
Join Date: Mar 2007
Posts: 205
Thanks: 4
Thanked 0 Times in 0 Posts
|
|
I have the code in place to fill my data set, it works fine.
Question: In my "Select..." clause is it possible to to a "%Like" and get only rows that have the phrase "Paid Check"?
Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim myConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\;Extended Properties=Text;"
Dim myConnection As New OleDbConnection(myConnectionString)
myConnection.Open()
Dim myCmdSelect As New OleDbCommand("SELECT * FROM SunTrust.csv", myConnection)
Dim myAdapter As New OleDbDataAdapter()
myAdapter.SelectCommand = myCmdSelect
Dim myDataset As New DataSet()
myAdapter.Fill(myDataset, "Suntrust")
myConnection.Close()
End Sub
|

October 23rd, 2009, 10:51 AM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
|
|
mmm.. not sure, you don't have fields definitions..
but what about filter the dataset after you loaded it??
__________________
HTH
Gonzalo
================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the proof.
================================================== =========
|
|
 |