Populating a WinDev Table from a SQL Server View

by | Jan 8, 2008 | Uncategorized | 4 comments

It’s not possible to add a SQL Server View in WinDev 11 to the Analysis file, so here is a simple way to do this using a few lines of WLanguage code.

First we create a Data Source which we can then map to our table component.

image

Now lets get the data from the SQL Server View.

image

Finally we read through the results and populate the table. Note that I have already added the table to the window and added the columns.

image

You use the Data Source to read through the records and fields. There is no intellisense in the Data Source so you will need to know the field names. For Example, Cost_Centre_Code in the code above is a field return from the view. The TAB is used as a break between each column in the Table Component.

Note that you need to add data using TableAdd in the same order as you have defined the columns in your component.

image

Spread the love