views:

93

answers:

1

i am getting error for statement

TInt err1 =stmt.Prepare(db,_L("INSERT INTO MyContacts(ServerContactID,UserName,FirstName,LastName,Country,IsBlocked,RequestStatus,MarkForDeletion) VALUES(:ServerContactID,:UserName,:FirstName,:LastName,:Country,:IsBlocked,:RequestStatus,:MarkForDeletion)"));

for this statements

if i print err1

i am getting 311 error

+1  A: 

-311 error from sqldb.h:

/**
An SQL database-specific error type return code from a call to the SQL API.

It indicates a general SQL error or a missing database.

@see RSqlStatement
@see ESqlDbError
@see TSqlRetCodeClass

@publishedAll
@prototype
*/
const TInt KSqlErrGeneral    = -311;

So the obvious first questions are:

  • Is the RSqlDatabase db properly connected?

  • Does the database have a table called MyContacts?

It is also a good habit to always end your SQL statements with a semicolon ; even though they are not always strictly necessary. (Don't have the tools here to test whether it is required in this case.)

laalto