Developer forum

Forum » CMS - Standard features » Datalist MSsql failing

Datalist MSsql failing

Jonas Mersholm
Reply

Hi there.

I have the following MSsql

 

SELECT
 TillidsmandsPortal_UserGroups.name, 
TillidsmandsPortal_UserGroups.deleted,
TillidsmandsPortal_UserGroups.UserID, 
TillidsmandsPortal_UserGroupUsers.UserID AS UID
FROM
    TillidsmandsPortal_UserGroups

LEFT JOIN  TillidsmandsPortal_UserGroupUsers ON  TillidsmandsPortal_UserGroupUsers.GroupID =  TillidsmandsPortal_UserGroups.ID

WHERE
    (TillidsmandsPortal_UserGroups.UserID =  @Session("DW_extranet_AccessUserID") OR TillidsmandsPortal_UserGroupUsers.UserID =  @Session("DW_extranet_AccessUserID") )
    AND TillidsmandsPortal_UserGroups.Deleted = 0

Which works just as expected. Now, if i add one line to the SELECT part of the query

SELECT
 TillidsmandsPortal_UserGroups.name, 
TillidsmandsPortal_UserGroups.deleted,
TillidsmandsPortal_UserGroups.UserID, 
TillidsmandsPortal_UserGroupUsers.UserID AS UID,
TillidsmandsPortal_UserGroups.ID AS gid
FROM
    TillidsmandsPortal_UserGroups

LEFT JOIN  TillidsmandsPortal_UserGroupUsers ON  TillidsmandsPortal_UserGroupUsers.GroupID =  TillidsmandsPortal_UserGroups.ID

WHERE
    (TillidsmandsPortal_UserGroups.UserID =  @Session("DW_extranet_AccessUserID") OR TillidsmandsPortal_UserGroupUsers.UserID =  @Session("DW_extranet_AccessUserID") )
    AND TillidsmandsPortal_UserGroups.Deleted = 0

IT does not execute any longer.

If i add that specific line to the query or any other primary key, it will simply not work! Why ?

The query works perfectly fine through the sql server manager.


Replies

 
Jonas Mersholm
Reply

Bump

 
Jonas Mersholm
Reply

Bump.. Again.

 

You must be logged in to post in the forum