PDA

View Full Version : Question related to Q3DataTable



mitesh_modi
29th November 2006, 08:49
Hi All,

I want to fill up my Q3DataTable without using database connection, which means i am instantiating Q3Datatable's object and then using addColumn and Q3SqlCursor i will fill row.

But in this effort, i am not able to fill up or insert any rows in DataTable.

------------------------------------------------------------------------------------------------
My Code:

Q3SqlCursor *cur = new Q3SqlCursor();
Q3DataTable *dt = new Q3DataTable( cur, false, 0, "Datatable" );

dt->setAccessibleName("Datatable");
dt->setObjectName("Datatable");


dt->addColumn("Col1","Col1");
dt->addColumn("Col2","Col2");


cur->setMode(Q3SqlCursor::Writable);
cur->select("Datatable");

QSqlRecord *row = cur->primeInsert();
row->setValue("Col1",0);
row->setValue("Col2",1);
cur->insert();

qWarning("number of row = %d, name of cursor = %s",dt->numRows(),qPrintable(cur->name()));

output:
Q3SqlCursor::setName: unable to build record, does 'Datatable' exist?
number of row = 0, name of cursor = (blank)
-----------------------------------------------------------------------------------------------

does anyone know other method or can give me a guide line how can achieve this thing?

For more knoweledge, i want some thing similar to DataTable of C# in QT4.0.

pls help me...

Thanks & Regards,
Mitesh..