delete record from COM("ADODB.Connection") dbase

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
bartemannekes
Forum Newbie
Posts: 2
Joined: Wed May 19, 2004 1:38 pm

delete record from COM("ADODB.Connection") dbase

Post by bartemannekes »

$Hi.

Trying to delete a record from an access database.
It appears that the record never gets deleted. What is going wrong?

$dbcon = new COM("ADODB.Connection") or die("Cannot start ADO");
$dbcon->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=".realpath("users.mdb").";");

$query = "DELETE * FROM users WHERE id=1;";
$rs = $dbcon->Execute($query);

$dbcon->Close();
$dbcon->Release();
$dbcon = NULL;


Thanks a lot for your help.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

shouldn't the line:

Code: Select all

$query = "DELETE * FROM users WHERE id=1;";
be

Code: Select all

$query = "DELETE FROM users WHERE id=1;";
?
bartemannekes
Forum Newbie
Posts: 2
Joined: Wed May 19, 2004 1:38 pm

Post by bartemannekes »

I've been told that msaccess can't handle the form you propose.
Anyway, your solution does not solve the problem.

B
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

They were lying to you ;)

Just checked such a query with Access 2003 on Access 2000 database. Worked like a charm. So your problem seems to be in ADODB, not in SQL query I proposed.
Post Reply