PDA

Click to See Complete Forum and Search --> : [RESOLVED] How should I handle this(csvReader)


Nitesh
Jul 2nd, 2008, 06:01 AM
Hi Guys,

I have a csv file. I use a CSVReader to get data of the file.

in the first column I have an order number. this is the process:

1. Use the order number and make an Entry into an Category table.
2. Get the last insert if and store in a variable
3. Loop through the csv file and check where the order number equals the current order number and then create items in an item table using the last insert id as a foreign key.

How should I do this. Should I use another csv reader to handle the item creating. please help

Xniper
Jul 4th, 2008, 04:16 AM
Is this (http://www.koders.com/java/fid24AE9FE9C8EBFF140F6303536D1F893EA2B4F702.aspx) the CSVReader you talk of? If you want to wirte to CSV then you could use CSVWriter (http://www.koders.com/java/fid0734BC79A65F5EDF3FD5AE70480EE857E2E18223.aspx).

To add a row to a CSV you should add it to the end of the CSV string with a column separating each row and with strings in quotes:

1,2,3,4,5,"hello"

Nitesh
Jul 7th, 2008, 05:53 AM
Ain't exactly what I need, but some great information I can use for the future. Thanks alot. I have solved my problem:wave: