Hi
I have modified the page that shows the user information, to include a list of the computers that the user has logged on to.
The list only shows the last login for each computer.
I made a new View called TFK_web30lastlogon_computers
SELECT TOP 100 PERCENT Username AS lastuser, MAX([Domain]) AS lastdomain, MAX(logontime) AS lastlogon, Computername
FROM dbo.tblCPlogoninfo
GROUP BY Username, Computername
ORDER BY Username, Computername
Then i made a new stored procedure called TFK_web30searchuser, which uses the new view
CREATE PROCEDURE dbo.TFK_web30searchuser(@name varchar(300))
AS SELECT dbo.tblADusers.Displayname, dbo.tblADusers.Title, dbo.tblADusers.Company, dbo.tblADusers.Department, dbo.tblADusers.Username,
dbo.tblADusers.Firstname, dbo.tblADusers.Lastname, dbo.tblADusers.Telephone, dbo.tblADusers.email, dbo.tblADusers.Userdomain,
dbo.tblADusers.Mobile, dbo.TFK_web30lastlogon_computers.lastlogon, dbo.TFK_web30lastlogon_computers.Computername
FROM dbo.tblADusers LEFT OUTER JOIN
dbo.TFK_web30lastlogon_computers ON dbo.tblADusers.Username = dbo.TFK_web30lastlogon_computers.lastuser AND
dbo.tblADusers.Userdomain = dbo.TFK_web30lastlogon_computers.lastdomain
WHERE (dbo.tblADusers.Username LIKE @name COLLATE SQL_Latin1_General_Cp1_CI_AI + '%') OR
(dbo.tblADusers.Firstname LIKE @name COLLATE SQL_Latin1_General_Cp1_CI_AI + '%') OR
(dbo.tblADusers.Lastname LIKE @name COLLATE SQL_Latin1_General_Cp1_CI_AI + '%') OR
(dbo.tblADusers.Displayname LIKE @name COLLATE SQL_Latin1_General_Cp1_CI_AI + '%') OR
(dbo.tblADusers.Displayname LIKE '%' + ' ' + @name COLLATE SQL_Latin1_General_Cp1_CI_AI + '%') OR
(dbo.tblADusers.Department LIKE @name COLLATE SQL_Latin1_General_Cp1_CI_AI + '%')
ORDER BY dbo.TFK_web30lastlogon_computers.Lastlogon desc
GO
Then last a modified the ASPX file it-userdetail.aspx, by adding the computerlisting from the APSX file it-searchuser.aspx
<%@ Page Language="VB" ContentType="text/html" %>
<%@ Register TagPrefix="MM" Namespace="DreamweaverCtrls" Assembly="DreamweaverCtrls,version=1.0.0.0,publicKeyToken=836f606ede05d46a,culture=neutral" %>
<!-- Connection info for Brukerinfo -->
<MM:DataSet
runat="Server"
id="dscomputers"
IsStoredProcedure="true"
CreateDataSet="true"
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_Lansweeper") %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_DATABASETYPE_Lansweeper") %>'
CommandText="dbo.web30userdetails"
Debug="true"
><Parameters>
<Parameter Name="@RETURN_VALUE" Type="Int" Direction="ReturnValue" />
<Parameter Name="@username" Value='<%# request("username") %>' Type="VarChar" Direction="Input" />
<Parameter Name="@userdomain" Value='<%# request("userdomain") %>' Type="VarChar" Direction="Input" />
</Parameters></MM:DataSet>
<MM:PageBind runat="server" PostBackBind="true" />
<MM:PageBind runat="server" PostBackBind="true" />
<!-- Connectioninfo for Computerliste -->
<MM:DataSet
runat="Server"
id="CIcomputers"
IsStoredProcedure="true"
CreateDataSet="true"
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_Lansweeper") %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_DATABASETYPE_Lansweeper") %>'
CommandText="dbo.TFK_web30searchuser"
Debug="true"
><Parameters>
<Parameter Name="@RETURN_VALUE" Type="Int" Direction="ReturnValue" />
<Parameter Name="@name" Value='<%# request("username") %>' Type="VarChar" Direction="Input" />
</Parameters></MM:DataSet>
<MM:PageBind runat="server" PostBackBind="true" />
<link href="css/ls.css" rel="stylesheet" type="text/css" />
<table width="100%" border="0" cellpadding="0" cellspacing="1">
<tr>
<td>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/users.png" width="48" height="40" hspace="4" /></td>
<td>
<table border="0" cellspacing="2" cellpadding="0">
<tr>
<td class="lijntje"><font size="4"><strong><%# dscomputers.FieldValue("Displayname", Container) %></strong></font></td>
</tr>
<tr>
<td><span class="bigt" >User details </span></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td>
<!-- Blank felt-->
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="4" cellpadding="0">
<tr>
<td valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="2" class="box">
<tr>
<td valign="top" width="80%">
<table width="100%" border="0" cellpadding="3" cellspacing="0" bgcolor="#FFFFFF" class="borderbox">
<tr>
<td valign="top">
<table width="100%" border="0" cellpadding="3" cellspacing="0" bgcolor="#FFFFFF" class="borderbox">
<tr>
<td align="right" class="lijntje"><strong>Title:</strong> </td>
<td class="lijntje"><%# dscomputers.FieldValue("title", Container) %> </td>
</tr>
<tr class="ne">
<td align="right" class="lijntje"><strong>Department:</strong> </td>
<td class="lijntje"><%# dscomputers.FieldValue("department", Container) %> </td>
</tr>
<tr >
<td align="right" class="lijntje"><strong>Office:</strong> </td>
<td class="lijntje"><%# dscomputers.FieldValue("Office", Container) %> </td>
</tr>
<tr class="ne">
<td align="right" class="lijntje"><strong>Upn:</strong> </td>
<td class="lijntje"><%# dscomputers.FieldValue("UPN", Container) %> </td>
</tr>
<tr >
<td align="right" class="lijntje"><strong>Username:</strong> </td>
<td class="lijntje"><%# dscomputers.FieldValue("Username", Container) %> </td>
</tr>
<tr class="ne">
<td align="right" class="lijntje"><strong>Domain:</strong> </td>
<td class="lijntje"><%# dscomputers.FieldValue("Userdomain", Container) %> </td>
</tr>
<tr >
<td align="right" class="lijntje"><strong>Last computer:</strong> </td>
<td class="lijntje"><a href="default.aspx?item=compdetail&comp=<%# dscomputers.FieldValue("Computername", Container) %>"><%# dscomputers.FieldValue("Computername", Container) %></a> </td>
</tr>
<tr class="ne">
<td align="right" class="lijntje"><strong>Last logon:</strong> </td>
<td class="lijntje"><%# dscomputers.FieldValue("lastlogon", Container) %> </td>
</tr>
<tr >
<td align="right" class="lijntje"><strong>E-mail:</strong> </td>
<td class="lijntje"><a href="mailto:<%# dscomputers.FieldValue("email", Container) %>"><%# dscomputers.FieldValue("email", Container) %></a> </td>
</tr>
<tr class="ne">
<td align="right" class="lijntje"><strong>Telephone:</strong> </td>
<td class="lijntje"><a href="callto:<%# dscomputers.FieldValue("Telephone", Container) %>"><%# dscomputers.FieldValue("Telephone", Container) %></a> </td>
</tr>
<tr >
<td align="right" class="lijntje"><strong>Mobile:</strong> </td>
<td class="lijntje"><a href="callto:<%# dscomputers.FieldValue("Mobile", Container) %>"><%# dscomputers.FieldValue("Mobile", Container) %></a> </td>
</tr>
<tr class="ne">
<td align="right" class="lijntje"><strong>Fax:</strong> </td>
<td class="lijntje"><%# dscomputers.FieldValue("Fax", Container) %> </td>
</tr>
<tr >
<td align="right" valign="top" class="lijntje"><strong>Company:</strong> </td>
<td class="lijntje"><%# dscomputers.FieldValue("company", Container) %> <br />
<%# dscomputers.FieldValue("street", Container) %> <br />
<%# dscomputers.FieldValue("zip", Container) %> <%# dscomputers.FieldValue("city", Container) %><br />
<%# dscomputers.FieldValue("country", Container) %></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td valign="top"><img src="smallthumb.aspx?user=<%# dscomputers.FieldValue("Username", Container) %>&domain=<%# dscomputers.FieldValue("Userdomain", Container) %>&size=200" class="picbox" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/users.png" width="48" height="40" hspace="4" />
</td>
<td>
<table border="0" cellspacing="2" cellpadding="0">
<tr>
<td class="lijntje"><span class="bigt">Results for search "<%=request("username")%>"</span>
</td>
</tr>
<tr>
<td><%= CIcomputers.RecordCount %> items found
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td>
<!-- blank felt -->
<td>
</tr>
<tr>
<td><%if CIcomputers.recordcount <> 0 then%>
<table width="100%" border="0" cellpadding="2" cellspacing="0">
<tr>
<td valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="2" class="box">
<tr>
<td valign="top">
<table width="100%" border="0" cellpadding="3" cellspacing="0" bgcolor="#FFFFFF" class="borderbox">
<tr>
<td valign="top">
<table width="100%" border="0" cellpadding="3" cellspacing="0" bgcolor="#FFFFFF" class="borderbox">
<tr>
<td valign="middle" class="tblcell"> </td>
<td valign="middle" class="tblcell">Display name </td>
<td valign="middle" class="tblcell">Department </td>
<td valign="middle" class="tblcell">Title </td>
<td valign="middle" class="tblcell">Computer </td>
<td valign="middle" class="tblcell">Logon Time </td>
</tr>
<%dim tal as integer
dim CIrow as system.data.datarow
tal = 1%>
<% For Each CIrow In CIcomputers.DefaultView.Table.Rows%>
<tr <%if (tal mod 2) = 0 then%>class="ne"<%end if%>>
<td height="30" align="center" valign="middle" class="lijntje"><a href="default.aspx?item=userdetail&username=<%=CIrow("username") %>&userdomain=<%=CIrow("userdomain")%>"><img src="smallthumb.aspx?user=<%=CIrow("username") %>&domain=<%=CIrow("userdomain") %>&size=26" border="0" align="baseline" class="pic" /></a></td>
<td class="lijntje"><a href="default.aspx?item=userdetail&username=<%=CIrow("username") %>&userdomain=<%=CIrow("userdomain")%>"><%=CIrow("displayname") %></a> </td>
<td class="lef"><%=CIrow("department") %> </td>
<td class="lef"><%=CIrow("title") %> </td>
<td class="lef"><a href="default.aspx?item=compdetail&comp=<%=CIrow("Computername") %>"><%=CIrow("computername") %></a> </td>
<td align="right" class="lef"><%=CIrow("lastlogon") %> </td>
</tr><%tal = tal + 1%>
<%next%>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<%end if%>
</td>
<td>
<!-- blank felt -->
</td>
</tr>
</table>
Now when i search for a user and click to get the user details displayed i also get to se all the computers where the user has login.