You are here: SQL - INSERT INTO booleans « PHP « IT news, forums, messages
SQL - INSERT INTO booleans

Posted by Tim Burgan on 01/20/05 00:43

Hello,


I'm trying to insert a new row using the following SQL:

$db_sql = "INSERT INTO tblStudents (name, username, password, expiry,
permissions, website, displayUser) VALUES ('Joe',
'joejoe','pw4joe','20-Jan-05','staff','true','false');";

In using MS Access via COM, the data types for each column (in order)
is: string, string, string, date, string, boolean, boolean.


I am continually getting a data type mismatch error (relating to the
boolean columns) when trying to execute this code.

I've tried removing the single quotes, but that returns a syntax error.

What do I do? Any assistance would be greatly appreciated.


Tim


PS: For those that are unclear of who COM works, this is my code to
connect to the database with a DNS-less connection.

/* Open the connection to the database */
$db_connection = new COM("ADODB.Connection") or die("Cannot start ADO");
$db_connstr = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=".
realpath("../data2004/contentdb01.mdb") .";DefaultDir=".
realpath("../data2004");

$db_connection->open($db_connstr);

/* Set the SQL */
$db_sql = "INSERT INTO tblStudents (name, username, password, expiry,
permissions, website, displayUser) VALUES ('Joe',
'joejoe','pw4joe','20-Jan-05','staff','true','false');";

/* Execute SQL */
$rs = $db_connection->execute($db_sql);

/* Close the database connection */
$db_connection->Close();
$rs = null;
$db_connection = null;

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация