Hey all,
I'm getting this error only when I have two similar entries in an login_audit table where the only difference is the actionhost and date. The query works fine in sqlserver. just not in the dataset.
What can I do to solve this problem?
The table structure is: -
userID(Guid)
-
username (nvarchar(50))
-
firstname (nvarchar(50))
-
lastname(nvarchar(50))
-
email(nvarchar(MAX))
-
isAdmin bit
-
Action (nvarchar(20))
-
ActionHost(nvarchar(30))
-
Date datetime
-
The entries: -
860B3D0F-D166-4388-82C0-EA5D77C2E231
-
newuser
-
New
-
User
-
new.user@company.com
-
1
-
Logged In
-
LOCALMACHINE
-
Apr 3 2008 3:24PM
-
-
860B3D0F-D166-4388-82C0-EA5D77C2E231
-
newuser
-
New
-
User
-
new.user@company.com
-
1
-
Logged In
-
SERVERNAME
-
Apr 3 2008 3:23PM
-
And this is the stored procedure: -
ALTER PROCEDURE [Security].[User_SelectDepartmentMembersLoginInfo]
-
@UserID uniqueidentifier
-
AS
-
BEGIN
-
SELECT DISTINCT [Security].[User].UserID, Username, FirstName, LastName, Email, IsSysAdmin, [Action], ActionHost, CONVERT(varchar(MAX),MAX(Date)) AS LastLoggedIn
-
FROM [Security].[User] LEFT OUTER JOIN Audit.[Login] ON [Security].[User].UserID = Audit.[Login].UserID LEFT OUTER JOIN [Security].DepartmentMembers ON [Security].[User].UserID = DepartmentMembers.UserID
-
WHERE ((@UserID IN (SELECT UserID FROM [Security].[User] WHERE IsSysAdmin = 'True'))
-
OR (DepartmentMembers.DepartmentID = (SELECT DepartmentID FROM [Security].DepartmentMembers WHERE UserID = @UserID AND IsDeptAdmin = 'True'))
-
AND (([Action] = 'Logged In') OR ([Action] IS NULL)))
-
GROUP BY [Security].[User].UserID, Username, FirstName, LastName, Email, IsSysAdmin, [Action], ActionHost
-
ORDER BY LastLoggedIn DESC, Username
-
-
END
-
2 3313
Hey all,
I'm getting this error only when I have two similar entries in an login_audit table where the only difference is the actionhost and date. The query works fine in sqlserver. just not in the dataset.
What can I do to solve this problem?
The table structure is: -
userID(Guid)
-
username (nvarchar(50))
-
firstname (nvarchar(50))
-
lastname(nvarchar(50))
-
email(nvarchar(MAX))
-
isAdmin bit
-
Action (nvarchar(20))
-
ActionHost(nvarchar(30))
-
Date datetime
-
The entries: -
860B3D0F-D166-4388-82C0-EA5D77C2E231
-
newuser
-
New
-
User
-
new.user@company.com
-
1
-
Logged In
-
LOCALMACHINE
-
Apr 3 2008 3:24PM
-
-
860B3D0F-D166-4388-82C0-EA5D77C2E231
-
newuser
-
New
-
User
-
new.user@company.com
-
1
-
Logged In
-
SERVERNAME
-
Apr 3 2008 3:23PM
-
And this is the stored procedure: -
ALTER PROCEDURE [Security].[User_SelectDepartmentMembersLoginInfo]
-
@UserID uniqueidentifier
-
AS
-
BEGIN
-
SELECT DISTINCT [Security].[User].UserID, Username, FirstName, LastName, Email, IsSysAdmin, [Action], ActionHost, CONVERT(varchar(MAX),MAX(Date)) AS LastLoggedIn
-
FROM [Security].[User] LEFT OUTER JOIN Audit.[Login] ON [Security].[User].UserID = Audit.[Login].UserID LEFT OUTER JOIN [Security].DepartmentMembers ON [Security].[User].UserID = DepartmentMembers.UserID
-
WHERE ((@UserID IN (SELECT UserID FROM [Security].[User] WHERE IsSysAdmin = 'True'))
-
OR (DepartmentMembers.DepartmentID = (SELECT DepartmentID FROM [Security].DepartmentMembers WHERE UserID = @UserID AND IsDeptAdmin = 'True'))
-
AND (([Action] = 'Logged In') OR ([Action] IS NULL)))
-
GROUP BY [Security].[User].UserID, Username, FirstName, LastName, Email, IsSysAdmin, [Action], ActionHost
-
ORDER BY LastLoggedIn DESC, Username
-
-
END
-
Check your table. I think you have a PRIMARY KEY constraint that prevents you from inserting those duplicate rows.
-- CK
Check your table. I think you have a PRIMARY KEY constraint that prevents you from inserting those duplicate rows.
-- CK
lol.
I just saw that too!
I was just about to post to disregard that.
my bad.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Byron |
last post by:
Using Visual Basic .Net 2003 Standard Edition
Am attempting to join two oleDataAdapters. Right
clicking on the second oleDataAdapter(the child) to
preview the data, and then clicking the Fill...
|
by: Dotnet Gruven |
last post by:
I've posted this in the adonet group, however it was suggested I might have
better luck here....
=============================================================
I'm trying to use a typed dataset and...
|
by: Programatix |
last post by:
Hi,
Have anyone ever benchmark the TableAdapter performance compared to
DataTable's Load method? I found out that the DataTable's Load method is
about 10x faster than TableAdapter's Fill method....
|
by: Mike |
last post by:
Dear Group,
When I add a DataTable to a Typed Dataset, and a TableAdapter to the
DataTable, I am able to create methods to send updates directly to the
database (GenerateDBDirectMethods),...
|
by: Rob Dob |
last post by:
Hi,
in the old days, pre .Net 2.0 I could just modify the SQLCommand of the
SQlDataAdapter to reflect a different where clause and then issue a .Fill(),
and Whamo!!! everything worked.. How am...
|
by: Frieder Bürzele |
last post by:
Hi,
Im trying to integrate a rss feed into my page but struggle to fetch the
dynamic generation of the rss feed
If I type this into the browser as a result the xml file is shown as
expected...
|
by: Jeff |
last post by:
I've been having this problem for weeks and its been stumping me. By
the way, Im working with MS SQL 2000, ASP.NET2 and Visual Studio 2005.
I am recieving an error, when executing a SELECT...
|
by: Bobby Edward |
last post by:
This line of code...
Using db As New dsUsersTableAdapters.useroptionsTableAdapter
Produces this error:
Out of range value adjusted for column 'EngrAlertForNewQuestions' at row
1
Any idea...
|
by: Bobby Edward |
last post by:
I have an xsd dataset. I created a simple query called GetDataByUserId. I
can preview the data fine!
I created a very simple BLL function that calls it and returns a datatable.
When I run...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |