Results 1 to 3 of 3

Thread: How to bind to QSqlTableView with data from Microsoft SQL Server?

  1. #1
    Join Date
    Jun 2010
    Location
    Egypt
    Posts
    4
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows Symbian S60

    Default How to bind to QSqlTableView with data from Microsoft SQL Server?

    Hi
    i have a problem when i want to bind data from Microsoft SQL Server with QSqlTableView,

    Qt Code:
    1.  
    2. model->setTable("tblArtist"); // table Name
    3. cdb.GetClientDataSet("SELECT tblArtist.* FROM tblArtist", model); //this function get the Query and return by
    4. // reference Table Model
    5. ui->tblView->setModel(model);
    To copy to clipboard, switch view to plain text mode 
    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

  2. #2
    Join Date
    Jun 2010
    Location
    Egypt
    Posts
    4
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: How to bind to QSqlTableView with data from Microsoft SQL Server?

    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

  3. #3
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: How to bind to QSqlTableView with data from Microsoft SQL Server?

    Change
    Qt Code:
    1. cdb.GetClientDataSet("SELECT tblArtist.* FROM tblArtist", model);
    To copy to clipboard, switch view to plain text mode 

    to
    Qt Code:
    1. model->select();
    To copy to clipboard, switch view to plain text mode 

    and see what happens

Similar Threads

  1. Replies: 16
    Last Post: 28th April 2020, 14:40
  2. QSqlTableModel and QSqlTableView question
    By waynew in forum Qt Programming
    Replies: 1
    Last Post: 14th December 2009, 00:06
  3. Replies: 1
    Last Post: 7th January 2009, 23:10
  4. Poor performance with Qt 4.3 and Microsoft SQL Server
    By Korgen in forum Qt Programming
    Replies: 2
    Last Post: 23rd November 2007, 10:28
  5. Sql Server cannot retrieve data from select
    By Atomino in forum Qt Programming
    Replies: 10
    Last Post: 7th September 2006, 16:37

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.