tags:

views:

1054

answers:

1

Hello everybody!

Tip me plase, how to insert a null value into table using Trolltech Qt 4.x SQL classes? QSqlQuery, I guess, or something else from QtNetwork. As analog of it, in .NET there is the System.DbNull class, which represents sql NULL.

And what type should I use for some object's property, that can hold both null-value and QString? In C# I could use System.Object.

+6  A: 

From QSqlQuery::addBindValue documentation:

To bind a NULL value, use a null QVariant; for example, use QVariant(QVariant::String) if you are binding a string.

Johannes Schaub - litb