PDA

View Full Version : Error in connecting to MS ACCESS



cutie.monkey
9th September 2008, 03:10
hi all...

i'm current developing a simple application that will connect to MS Access database..

My application connected successfully with the database using this code:




QString db = "DRIVER={Microsoft Access Driver (*.mdb)};";
db += "FIL={MS Access};DBQ=" + qApp->applicationDirPath ()" ;
db+= "/myaccessdb.mdb;";

QSqlDatabase defaultDB = QSqlDatabase::addDatabase("QODBC3");
defaultDB.setDatabaseName(db);



But when I started my query statement, this error occured..



[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1. QODBC3: Unable to execute statement



Here's my query:

SELECT ITE_CODE, ITE_DESC, UNT_PRIC FROM sampletb WHERE ITE_CODE= "95506562"


How can I fix this error? pls help.. thanks...