[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyKDE] QSqlRecord - adding a field (PyQt)
From:       "joanne matthews (RRes-Roth)" <joanne.matthews () bbsrc ! ac ! uk>
Date:       2007-01-23 13:11:35
Message-ID: EFDAAE7F4B83D243868A2F25AD8A4B38057ED826 () rothe2ksrv1 ! rothamsted ! bbsrc ! ac ! uk
[Download RAW message or body]

I'm just trying to add a field to a record like this:

db = QtSql.QSqlDatabase.addDatabase("QSQLITE")
db.setDatabaseName("databaseName")
rec=db.record("tableName")
if not rec.contains("fieldName"):
    fieldNotExistError("tableName","fieldName")
    #fieldName=QtSql.QSqlField("exportGIS",QtCore.QVariant.Int)
    fieldName=QtSql.QSqlField()
    fieldName.setName("fieldName")
    fieldName.setType(QtCore.QVariant.Int)
    print db.lastError().text()
    rec.append(fieldName)

But it doesn't append the field. I've also tried rec.insert() but that
doesn't insert the field either. I don't get any error messages printed.
Can someone tell me what I'm doing wrong.

Thanks


    

_______________________________________________
PyKDE mailing list    PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic