Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3368: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3370: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3371: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3372: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
OrbWorks Community Forum • View topic - Read >1 records ?

Read >1 records ?

Discuss OrbForms Designer and PocketC Architect

Postby fookyean on Sat Jun 21, 2003 8:30 am

I has a function to load all the record from db, but the read() only read 1 record only. Anybody can help ?

void loadStockListData(){
int nRec;
StringList slStk_List;
Database db;
DBRecord rec, jrec;

StockData* tempentry;

tempentry = new StockData[10];

// open the database
if (db.open(stockRecMgr.sDBName, false)) {

nRec=0;
db.getrec(nRec, jrec, false);

// Can not get more than one record, why ?
jrec.read(&tempentry[0], typeof(StockData), 10);
jrec.close();
for (nRec=0;nRec<10;nRec++)
{
slStk_List.add( tempentry[nRec].code ) ;
}

} // db open

listStock.setitemslist(slStk_List);
}

thanks.
fookyean
 
Posts: 8
Joined: Sat Jun 21, 2003 8:29 am

Postby rogernc on Sat Jun 21, 2003 4:37 pm

The way you have that written it will only read 1 record. You would have to do the getrec and read within your for loop so it will cycle through each record and add them to your stringlist.
Hope this helps.

Roger C
rogernc
 
Posts: 10
Joined: Thu Apr 17, 2003 10:56 am

Postby kda406 on Tue Apr 24, 2007 12:46 pm

I am trying to display lines from log files that have been downloaded from a micro controller in the same way Fookyean was attempting to here. I need to get 12 records from the database, and show them in a stringlist or similar. I don't see any other references to this in the OrbForms help, or on this forum.

<b>Is there a way to get multiple (like 12) records from a database at one time without repeated Database.getrec() commands?</b>

Also, why in the world does DBRecord.read() require a count parameter and advance if it will only ever give you one record in return??? This seems wrong. What are we missing here?

Many thanks,
Kyle
kda406
 
Posts: 86
Joined: Wed Sep 10, 2003 1:24 pm
Location: Atlanta, GA, USA

Postby mlambrigger on Wed May 30, 2007 12:19 pm

Have you try to define not a DBRecord object but an array of DBRecord an pass it to the getrec() function with more than 1 as number parameters

Marc Lambrigger
Marc Lambrigger
mlambrigger
 
Posts: 113
Joined: Fri Feb 13, 2004 11:07 am
Location: Switzerland

Postby dewey on Thu Jun 28, 2007 2:28 am

read() takes a count so that you can read multiple pieces of data from the same record. For example, if your record contains 10 ints, you could read them all by calling read(intArray, typeof(int), 10).
dewey
Site Admin
 
Posts: 749
Joined: Sun Oct 21, 2007 5:12 am


Return to OrbForms Designer and PocketC Architect

Who is online

Users browsing this forum: No registered users and 1 guest

cron