RE: [PHP-WIN] Hi,I have an idea of no DSN to use access,but i faild.

From: Date: Fri, 08 Sep 2000 14:23:01 +0000
Subject: RE: [PHP-WIN] Hi,I have an idea of no DSN to use access,but i faild.
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-2528@lists.php.net to get a copy of this message
Hi Christine Green, I'd like to say that David Coulter was on the right track (see previous messages below), except that you are not allowed to use the dot . which is a VBScript/JScript/Java way of referencing objects and methods. In C++ and PHP you *MUST* use -> instead when referencing objects and methods. Try -> and think about PHP being an expression-based language... Your code should look like this instead - $dbc = new COM("ADODB"); $dbc -> $Connection -> Open($connString); // the $Connection object might be instantiated in the ADODB object (????) // then call the Open method of the $Connection object (has it been instantiated???) or something like that. Correct me if I'm wrong but you cannot use the Java-like dot notation. I'm sorry I can't be of much help, but I haven't played around with PHP COM and I will never do so because it's just not the way to go. COM is not reliable and can crash IIS. If you want to do distributed apps it is better to instantiate Java servlets in PHP. Java runs inside a JVM and is protected/isolated from IIS. Good Luck. -----Original Message----- From: Christine Green [mailto:christine19990815@163.net] Sent: Friday, 8 September 2000 12:54 PM To: David Coulter Cc: php-windows@lists.php.net Subject: Re: [PHP-WIN] Hi,I have an idea of no DSN to use access,but i faild. Thank you ! But i got error as : Warning: Invoke() failed: in F:\php\program\ado\access.php on line 4 Warning: Invoke() failed: in F:\php\program\ado\access.php on line 7 My php code is: <? $connString = "Provider=Microsoft.Jet.OLEDB.4.0;DataSource=F:\\WINNT\\system32\\ias\\dnary .mdb"; $dbc = new COM("ADODB.Connection"); $dbc->Open($connString); $sqlString = "SELECT * FROM Vendors"; $rs = new COM("ADODB.Recordset"); $rs->Open($sqlstring, $dbc, 3, 3); ?> ----- Original Message ----- From: "David Coulter" <david@luminarytech.com> To: "Christine Green" <christine19990815@163.net> Sent: Thursday, September 07, 2000 10:58 PM Subject: Re: [PHP-WIN] Hi,I have an idea of no DSN to use access,but i faild. > Well, I'll take a shot at this... I know how to do it in ASP so this might > work. :) > > <? > $connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data > Source=d:\inetpub\wwwroot\news.mdb" > $dbc = new COM("ADODB.Connection"); > $dbc->Open $connString > $sqlString = "SELECT * FROM Vendors"; > $rs = new COM("ADODB.Recordset"); > $rs->Open $sqlstring, $dbc, 3, 3 > file://do whatever with the array of the recordset > ?> > > Like I said though, this is what it looks like written in ASP, but with the > PHP syntax. I could be totally off. Hope it helps though. :) > > David Coulter > > Christine Green wrote: > > > Hi all,i have an idea to use access and not config dsn, > > but i don't know to how to do. > > exa: > > <? > > $cnpath = "DBQ=F:\\WINNT\\system32\\ias\\dnary.mdb"; > > $driver = "DRIVER={Microsoft Access Driver (*.mdb)};"; > > $pr = $driver.$cnpath; > > > > $dbc = new COM("ADODB.Connection"); > > $dbc->Provider = $pr; > > $dbc->Open("nwind"); > > $rs = $dbc->Execute("select * from Vendors"); > > ... ... > > > > ?> > > But i get a error and the ie will close, > > i don't know what cause that. > > > > Any advice ? > > > > Christine Green > > > > -- > > PHP Windows Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net > > For additional commands, e-mail: php-windows-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.windows (#2528) next »