Kevin Wolfhagen

Kevin Wolfhagen

  • NA
  • 1
  • 1.3k

Database design, or parameter/query issue in Lightswitch ?

Jul 11 2013 10:34 AM

A good day !

I'm having some issues with my sql database design… i think.
Im starting out on building my first application using Visual Studio Lightswitch (C#), together with a sql database in sqlexpress.

The problem i have with it, is a parameter/query, to filter my data correctly.
But i don't know if it is a database design issue, or just the wrong parameter i'm using.

I have created a screen in the lightswitch application called: Relations. (by just inserting the table: relations. And adding all tables relating to Relations).
In the Relations Screen, i have added 2 Relations, and 2 computers and 2 users corresponding to that Relation. (See attachment, DataCompany1 & DataCompany2)

When opening the Workstation Details, i want to be able to add a user that works at the company the computer is being used. (See attachmentUserSelection)

I have made a query/parameter in the WorkstationDetails view, but it is still not filtering the 'Users' only belonging to the company the 'Workstation' is being used.
Query: Where Workstation.Relation.CompanyNumber = Parameter(CompanyNumber)
Parameter: CompanyNumber of type Short Integer

Parameter Binding: Users.SelectedItem.Relation.CompanyNumber

I also uploaded my SQLDatabase (database.zip)

Hopefully you guys can help, i've been stuck on this issue for quite some time now.

https://www.dropbox.com/s/m1vhzwnl5oohg87/DatabaseDesign.JPG
https://www.dropbox.com/s/nqfsr60lh7prnng/DatabaseDesign.vsdx
https://www.dropbox.com/s/bt95ax3gvuhlc1p/DataCompany1.JPG
https://www.dropbox.com/s/ijtshb8i26iz2z0/DataCompany2.JPG
https://www.dropbox.com/s/ix7szyachef7hmt/ParameterBinding.jpg
https://www.dropbox.com/s/1otswlbcg0dk2ex/Query.jpg
https://www.dropbox.com/s/say1av10tleag99/UserSelection.jpg
https://www.dropbox.com/s/pbo8c008k15pit2/Database.zip