PDA

View Full Version : How to bind to QSqlTableView with data from Microsoft SQL Server?



Hany
1st June 2010, 07:31
Hi
i have a problem when i want to bind data from Microsoft SQL Server with QSqlTableView,



QSqlTableModel *model;

model->setTable("tblArtist"); // table Name
cdb.GetClientDataSet("SELECT tblArtist.* FROM tblArtist", model); //this function get the Query and return by
// reference Table Model
ui->tblView->setModel(model);

this is the first application with C++ Qt4, i'm a C# developer.
i use Qt4.6 under Windows 7 and Microsoft Sql Server 2005 Express
Thanks

Hany
2nd June 2010, 11:11
hi
any know the solve of the problem please write it.
i really need to know how to fill table view with a database from Microsoft SqlServer
Thanx

tbscope
2nd June 2010, 11:19
Change

cdb.GetClientDataSet("SELECT tblArtist.* FROM tblArtist", model);

to

model->select();

and see what happens