Important: Please read the Qt Code of Conduct -

Show SQL database in list form

  • I have an MS SQL database that I am displaying in a QWidget (set as the centralWidget in a QMainWindow) and it displays as a database with cells. I need to be able to click a button, such as print preview, and have all the records display in a more list like format where the 1st line is the 1st record with feilds from 0 till it reaches a specified column then jump to the next line and that would continue with the 1st record until it reaches another specified column and so on for up to 6 lines then go to the next record and repeat.

    Each of the name's of the columns where it should stop and skip to the next line start with the same word that is unique to those columns but are not completely identical (eg. Speical info address, Special info services, ...).

    I would need it to show up in a format like this:
    Name: [Last Name], [First Name] [Middle Name], [Age], [Address] [Special info Name] [Service Id]
    Service: [Service Location] [Special Info Service] [Service day] [Service time]
    2nd Service: [Location] [Time] [Special Info 2nd service] [Employee] [Assistant]
    Other: [other location] [type] [Special Info other]
    Relationships: [Relationships] [Special Info Relationships]

    each feild in brackets is its own feild in the database generally in that order.

    Is there a way to do this?

    Thanks for any help!

Log in to reply