Re: Using COM in PHP4 (ADO)

From: Date: Wed, 07 Jun 2000 18:13:16 +0000
Subject: Re: Using COM in PHP4 (ADO)
Groups: php.general 
Request: Send a blank email to php-general+get-1241@lists.php.net to get a copy of this message
Hi, I know this does not solve the "error" in php4, if it is an error, but why use COM and ADO to select data from an Access database when you can use native ODBC. After all ADO is just another name for ODBC ? - Frank >Hi everybody, > >I've tried to use ADO (ActiveX Data Objects) through >COM in PHP4. At the first step it works very well: > ><?php >$adoConn = new COM("ADODB.Connection"); >echo "ADO Version: " . $adoConn->Version; >define(CSTR, "Driver={Microsoft Access Driver (*.mdb)};DBQ=Auction.mdb"); >$intConn = $adoConn->Open(CSTR, 2); >if ($adoConn->State == 1) { > echo "<br>Connection successfully open:<br>"; > $adoRS = $adoConn->Execute("SELECT * FROM address", &$records); > echo $adoConn->ConnectionString; > echo "<br>" . $records . " Records found"; >} >?> > >The connection works so far. The following code gives all >column names of the Access-table and there size (works well): > ><?php >for($i = 0; $i < $adoRS->fields->count - 1; $i++): > echo $adoRS->fields[$i]->name . "<br>"; > echo $adoRS->fields[$i]->DefinedSize . " Byte max.<br>"; >endfor; >?> > >And following sequence should go through the records: > ><?php >while (!$rs->eof): > for($i = 0; $i < $rs->fields->count - 1; $i++): > echo $rs->fields->item[$i]; > endfor; > $rs->movenext; >endwhile; >?> > >But the method "item" is not defined PHP replied. I've >tried dozens of variants to catch the content of a field. >No way -> it seems that the COM-Interface has problems >to translate the collection-structure often used in ADO. > >I've also tried the com_prop and all other "alternative" >functions in PHP available - same result. Here the errors: > >Warning: PropGet() failed >Warning: Invoke() failed > >This happens only with objects containing records (data), >all properties with static values work well. > >Any hints, suggestions, ideas from the experts here? > >Jörg Krause >****************************** >Mail: joerg@krause.net >Info: www.joerg.krause.net >****************************** > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net >For additional commands, e-mail: php-general-help@lists.php.net >To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > Swwwing A/S Frank M. Kromann VP Development Phone: +45 70 20 77 20 Fax: +45 70 20 77 21 http://www.swwwing.com

« previous php.general (#1241) next »