×

Discussion Board

Results 1 to 3 of 3

Hybrid View

  1. #1
    Regular Contributor
    Join Date
    May 2006
    Location
    Oldenburg/Germany
    Posts
    89

    Can't insert data in my database

    Hi.

    I've got a problem with the Symbian-DBMS, i can't insert data by SQL.
    Well, that's my code:

    PHP Code:
    TInt CDBase::CreateDB()
    {
        
    User::LeaveIfError(DBFs.Connect());
        
    DBFs.MkDirAll(dbFileName.DriveAndPath());
        
    ErrorCode DB.Create(DBFs,dbFileName.FullName());
        if(
    ErrorCode != KErrNone)
        {
            
    DBError 1;
        }
        else
        {
            
    ErrorCode DB.Execute(_L("CREATE TABLE zeit (zID COUNTER, morgens VARCHAR(8), mittags VARCHAR(8), abends VARCHAR(8), nachts VARCHAR(8))"));
            if(
    ErrorCode == KErrNone)
            {
                
    ErrorCode DB.Execute(_L("CREATE TABLE meds (medname VARCHAR(255))"));
                if(
    ErrorCode == KErrNone)
                {
                    
    ErrorCode DB.Execute(_L("INSERT INTO meds (medname) VALUES ('Schwul')"));
                    if(
    ErrorCode == KErrNone)
                    {
                        
    DBError 0;
                    }
                    else
                    {
                        
    DBError 1;
                    }
                }
                else
                {
                    
    DBError 1;
                }
            }
            else
            {
                
    DBError 1;
            }
        }

        return 
    DBError;

    At the insert, i'm getting an error. The errorcode is 1.
    Please help, would be very kind of you.

    Thanks!

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,692

    Re: Can't insert data in my database

    Note that RDbDatabase::Execute returns the number of affected rows. When you insert one row successfully, it returns 1.
    Also note that it is mentioned in the Help of all pre-3rd edition S60 SDK-s, also in 3rd ed. FP1, but not in the 3rd ed. or the 3rd ed. MR.

  3. #3
    Regular Contributor
    Join Date
    May 2006
    Location
    Oldenburg/Germany
    Posts
    89

    Re: Can't insert data in my database

    Thank you very much. My fault, i only looked for errors and forget that i was using an insert...

Similar Threads

  1. suckho, i have encontered the same problems. Could you tell me how you resolved it?
    By dicson_hu in forum Symbian Networking & Messaging (Closed)
    Replies: 4
    Last Post: 2005-12-09, 10:56
  2. GPRS connection problems on 6600..
    By suckho in forum Symbian Networking & Messaging (Closed)
    Replies: 10
    Last Post: 2005-12-02, 14:00
  3. Nokia 6600 Socket Server send delay Problem
    By dicson_hu in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2005-10-31, 07:37
  4. Replies: 2
    Last Post: 2004-09-15, 22:47

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×