Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


Format to read in CSV files


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-07-2008, 07:04 AM
Basic4ppc Veteran
 
Join Date: Apr 2007
Posts: 200
Default Format to read in CSV files

Hi,

Does anyone have a routine that reads CSV files of certain length? Moreover, I 'd like to know what the fastest way is to read these files. Do you have to use SQL?
thnx
Marc
Reply With Quote
  #2 (permalink)  
Old 02-07-2008, 08:29 AM
RandomCoder's Avatar
Basic4ppc Veteran
 
Join Date: May 2007
Location: UK
Posts: 486
Awards Showcase
Beta Tester 
Total Awards: 1
Default

The easiest way is to load the file into a table.
From there you can extract the data you want.
You can also use SQL which is faster for large databases, however I'm yet to learn how to use SQL (maybe some time soon I'll give it a try).

Regards,
RandomCoder
__________________
Desktop: Pentium D 920 (2.8GHz, 4MB L2 Cache, 800MHz FSB), 1024MB, 256MB Radeon X600, 250GB HD.
Device : Axim X51v XScale 624MHz, 3.7" VGA, 64MB SDRAM, 256MB Flash ROM + 1Gb SD.

"Defeat never comes to any man until he admits it."Josephus Daniels
Reply With Quote
  #3 (permalink)  
Old 02-07-2008, 09:21 AM
Basic4ppc Veteran
 
Join Date: Apr 2007
Posts: 200
Default

thnx,

I was wondering whether anyone had a routine which regardless of the parameters (which are read at runtime and passed through) could read a csv file. I am not too familiar with SQL myself, so I hope someone is.....
Marc
Reply With Quote
  #4 (permalink)  
Old 02-07-2008, 09:39 AM
RandomCoder's Avatar
Basic4ppc Veteran
 
Join Date: May 2007
Location: UK
Posts: 486
Awards Showcase
Beta Tester 
Total Awards: 1
Default

You don't need to understand SQL to use the table control.
The table control is very simple to use and will load the CSV file directly into the table cells.
All you then need to do is either filter the table or just extract the desired cells.

Regards,
RandomCoder
__________________
Desktop: Pentium D 920 (2.8GHz, 4MB L2 Cache, 800MHz FSB), 1024MB, 256MB Radeon X600, 250GB HD.
Device : Axim X51v XScale 624MHz, 3.7" VGA, 64MB SDRAM, 256MB Flash ROM + 1Gb SD.

"Defeat never comes to any man until he admits it."Josephus Daniels
Reply With Quote
  #5 (permalink)  
Old 02-07-2008, 09:41 AM
Basic4ppc Veteran
 
Join Date: Apr 2007
Posts: 200
Default

Well, I dont need a table actually. i want to store over a few million data in the CSV file to retrieve with a search function matching one or two entries.
Reply With Quote
  #6 (permalink)  
Old 02-07-2008, 09:54 AM
RandomCoder's Avatar
Basic4ppc Veteran
 
Join Date: May 2007
Location: UK
Posts: 486
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Quote:
Originally Posted by Stellaferox View Post
Well, I dont need a table actually. i want to store over a few million data in the CSV file to retrieve with a search function matching one or two entries.
A few million

You would be best to use SQL, although my understanding is that a table will still be required for SQL to utilise.
My approach is usually to try and understand a few examples of other peoples work and then tailor it to my own needs.
Here is a link to an example that Erel did some time ago, maybe it will help you... SQLite Viewer

Regards,
RandomCoder
__________________
Desktop: Pentium D 920 (2.8GHz, 4MB L2 Cache, 800MHz FSB), 1024MB, 256MB Radeon X600, 250GB HD.
Device : Axim X51v XScale 624MHz, 3.7" VGA, 64MB SDRAM, 256MB Flash ROM + 1Gb SD.

"Defeat never comes to any man until he admits it."Josephus Daniels
Reply With Quote
  #7 (permalink)  
Old 02-07-2008, 10:36 AM
Basic4ppc Veteran
 
Join Date: Apr 2007
Posts: 200
Default

hmmmmmm.... missed this little gem, though I thought I skimmed the forum daily.
Thnx!
Marc
Reply With Quote
  #8 (permalink)  
Old 02-07-2008, 11:10 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,199
Default

What type of data do you need to store?
Reply With Quote
  #9 (permalink)  
Old 02-07-2008, 11:34 AM
Basic4ppc Veteran
 
Join Date: Apr 2007
Posts: 200
Default

@ Erel

Hi erel,

I want to store a table containing numbers. The program computes the rank of a hand in poker with 7 cards, taken the best 5 out of it (Texas Holdem). Because there are 133784560 combinations with 7 cards out of 52, it takes too long to compute the hands, especially because I want to run simulations with dealing a lot of hands (Monte Carlo simulation) and compute the probability of winning with that certain hand against other random AI-hands. Therefore I want to generate a table and compare the hand to an index (with a unique longinteger) and retrieve the value of the hand.
Marc
Reply With Quote
  #10 (permalink)  
Old 02-07-2008, 06:04 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,199
Default

I recommend you to use the BinaryFile to store the data in a raw file.
Write with WriteInt64 and read with ReadInt64.
Every number occupies 8 bytes so it is very easy to navigate the file.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
read and delete sms...how? Byak@ Questions & Help Needed 1 10-12-2008 07:42 PM
PPC Help files format JamesC Questions & Help Needed 4 07-24-2008 01:36 PM
XML file read stratus Questions & Help Needed 8 06-20-2008 04:03 PM
How to know if a PM was read!? Cableguy Forum Discussion 0 05-12-2007 10:17 PM
Read a row (SQL) Nkieto Questions & Help Needed 2 05-03-2007 05:29 PM


All times are GMT. The time now is 03:38 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0