p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > .NET > Other .NET > WinForms/Console Application Design
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read

Welcome to the p2p.wrox.com Forums.

You are currently viewing the WinForms/Console Application Design section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 23rd, 2009, 09:31 AM
Friend of Wrox
Points: 923, Level: 11
Points: 923, Level: 11 Points: 923, Level: 11 Points: 923, Level: 11
Activity: 5%
Activity: 5% Activity: 5% Activity: 5%
 
Join Date: Mar 2007
Location: West Palm Beach, Florida, USA.
Posts: 198
Thanks: 4
Thanked 0 Times in 0 Posts
Question 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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old October 23rd, 2009, 09:45 AM
Friend of Wrox
Points: 6,570, Level: 34
Points: 6,570, Level: 34 Points: 6,570, Level: 34 Points: 6,570, Level: 34
Activity: 42%
Activity: 42% Activity: 42% Activity: 42%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,000
Thanks: 5
Thanked 37 Times in 36 Posts
Send a message via MSN to gbianchi
Default

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.
================================================== =========
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
The Following User Says Thank You to gbianchi For This Useful Post:
snufse (October 23rd, 2009)
  #3 (permalink)  
Old October 23rd, 2009, 10:47 AM
Friend of Wrox
Points: 923, Level: 11
Points: 923, Level: 11 Points: 923, Level: 11 Points: 923, Level: 11
Activity: 5%
Activity: 5% Activity: 5% Activity: 5%
 
Join Date: Mar 2007
Location: West Palm Beach, Florida, USA.
Posts: 198
Thanks: 4
Thanked 0 Times in 0 Posts
Question

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #4 (permalink)  
Old October 23rd, 2009, 11:51 AM
Friend of Wrox
Points: 6,570, Level: 34
Points: 6,570, Level: 34 Points: 6,570, Level: 34 Points: 6,570, Level: 34
Activity: 42%
Activity: 42% Activity: 42% Activity: 42%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,000
Thanks: 5
Thanked 37 Times in 36 Posts
Send a message via MSN to gbianchi
Default

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.
================================================== =========
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
import data from csv/xsl file to sql bex WinForms/Console Application Design 0 July 9th, 2009 03:34 PM
Import data to CSV itHighway Classic ASP Basics 0 September 15th, 2006 11:31 AM
Import data in CSV file itHighway Classic ASP Professional 0 September 15th, 2006 11:29 AM
Excel Vs CSV file - import performance itHighway Classic ASP Databases 0 August 5th, 2006 04:40 PM
how do I import CSV file into SQL Express 2005 victor888 C# 2005 0 March 20th, 2006 02:55 PM



All times are GMT -4. The time now is 12:27 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc