Hi,
first: It is not allowed in ADO to use one connection with more the one
Recordsets (Design-Problem)
second: this script lets php crash
$conn = new COM( "ADODB.Connection" );
$conn->Provider = 'SQLOLEDB';
$conn->Open( "Server=wincubix;Uid=oebb;Pwd=oebb;Database=cubix" );
$conn->Execute('SET DATEFORMAT ymd');
$rs = new COM( "ADODB.Recordset" );
$rs->ActiveConnection = $conn;
$rs->Open("SELECT DISTINCT * FROM news WHERE gueltig_von <= '2002-05-13'");
changing the script like this will prevent the AV
//$rs->ActiveConnection = $conn;
$rs->Open("SELECT DISTINCT * FROM news WHERE gueltig_von <=
'2002-05-13'", $conn);
I'm using the latest MSDAC (2.7) and the latest snapshot of php,
bye,
Michael Bretterklieber wrote:
> 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
[EMAIL PROTECTED]
homepage: http://www.jawa.at
--------- privat -----------
E-mail: [EMAIL PROTECTED]
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
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php