wired things with ADO (OLEDB)
| From: | Michael Bretterklieber | Date: | Mon, 13 May 2002 11:21:34 +0000 |
| Subject: | wired things with ADO (OLEDB) | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-19153@lists.php.net to get a copy of this message | ||
Hi,
I have strange problems accessing MSSQL over COM over ADO over OLEDB (SQLOLEDB).
In the script below produces the last sql-statement the sql-error (MSSQL Errornumber: 242)
*
Warning*: Invoke() failed: Ausnahmefehler aufgetreten. *Source* : Microsoft OLE DB Provider for SQL Server *Description* : Bei der Konvertierung eines
char-Datentyps in einen datetime-Datentyp liegt der datetime-Wert außerhalb des gültigen Bereichs. in *D:\adocrash2.php* on line *38*but the statement is correct. If I use the same recordset no problems, but If I use new recordset but with the same Connection, then this error occurs the third time opening a new recordset with the same connection. I also tries to set again (SET DATEFORMAT ymd), but this statement has no effect anymore. This seems to be a problem with the COM-Module in PHP, bye, <?php $conn = new COM( "ADODB.Connection" ); $rs = new COM( "ADODB.Recordset" ); $conn->Provider = 'SQLOLEDB'; $conn->Open( "Server=wincubix;Uid=oebb;Pwd=oebb;Database=cubix" ); $conn->Execute('SET DATEFORMAT ymd'); $rs->ActiveConnection = $conn; $rs->Open("SELECT DISTINCT * FROM news WHERE gueltig_von <= '2002-05-13'"); echo '<table>'; while (!$rs->EOF) { echo '<tr>'; for ($i=0; $i < $rs->Fields->Count; $i++) {
echo '<td>';
echo $rs->Fields[$i]->Value;
echo '</td>';
}
echo '</tr>';
$rs->MoveNext();
}
echo '</table>';
$rs->Close();
$rs->Open("SELECT DISTINCT * FROM news WHERE gueltig_von <= '2002-05-13'");
$rs->Close();
$rs->Open("SELECT DISTINCT * FROM news WHERE gueltig_von <= '2002-05-13'");
$rs2 = new COM( "ADODB.Recordset" );
$rs2->ActiveConnection = $conn;
$rs2->Open( "SELECT DISTINCT * FROM news WHERE gueltig_von <= '2002-05-13'");
?>
--
--------------------------------------
Michael Bretterklieber
LCP
JAWA Management Software GmbH
Liebenauer Hauptstr. 200
A-8041 GRAZ
Tel: ++43-(0)316-403274-12
Fax: ++43-(0)316-403274-10
GSM: ++43-(0)676-93 96 698
Michael.Bretterklieber@jawa.at
homepage: http://www.jawa.at
--------- privat -----------
E-mail: mbretter@inode.at
homepage: http://www.inode.at/mbretter
--------------------------------------
"...the number of UNIX installations has grown to 10, with more expected..."
- Dennis Ritchie and Ken Thompson, June 1972