Hi All

I want to use QSql in my application to call History..

I have gone through the qt examples and documents and i tried small examples based the examples given with Sdk.

I want to store call history..

In examples i did like
Qt Code:
  1. QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
  2. db.setDatabaseName(":memory:");
  3. if (!db.open()) {
  4. return;
  5. }
  6. QSqlQuery query;
  7. //query.exec("create table yuvaraj ( id int , name varchar(20000))");
  8. query.exec("insert into yuvaraj values(1000,'"+QString(str)+"')");
  9. model = new QSqlRelationalTableModel(this);
  10. model->setTable("yuvaraj");
  11. model->select();
  12. QMessageBox::information(0,"1",QString("yuvarj"));
  13. mapper = new QDataWidgetMapper(this);
  14. mapper->setModel(model);
  15. mapper->addMapping(ui->textBrowser, model->fieldIndex("name"));
  16. QMessageBox::information(0,"2",QString("yuvarj"));
  17. mapper->toFirst();
To copy to clipboard, switch view to plain text mode 

there isan another way to create own database


Qt Code:
  1. QSqlDatabase db = QSqlDatabase::addDatabase("QPSQL");
  2. db.setHostName("customer");
  3. db.setDatabaseName("customdb");
  4. db.setUserName("yuvaraj");
  5. db.setPassword("yuvaraj");
  6. bool ok = db.open();
To copy to clipboard, switch view to plain text mode 

i have one doubt .which method i have to use.if declare this code at constructor every time database and table is creating..

Where can i find good example based one QSql apart from examples.

Can you please suggest me

Thanks

Yuvaraj R