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 3325 ck9663 2,878
Recognized Expert Specialist
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 Dataset
button produces the MessageBox "Failed to enable
constraints..."
The DataSet is setup correctly, and I've reduced the
Access Tables to only one record each, no empty fields.
I know the relationship is correct.
Is there a bug in VB.net that...
|
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 ObjectDataSource binding to a SQLX db
using a foreign key to filter the returned result set to display in a
GridView.
The error message in the subject line is generated when I try to bind the
following GridView to the ObjectSource that follows...
|
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.
I used the same SELECT query and DataSet (predefined), for both test.
For the DataTable's Load method, we first need to create a DataReader.
|
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), however when my TableAdapter Fill SQL
contains a WHERE clause which looks up a field from another joined table,
the Fill works perfectly, but I cannot Insert, Update or Delete using the
TableAdapter.
Does anyone know why this is?
|
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 I to accomplish the same task using
..NET 2.0 and the NEW "TableAdapter", I can't see myself creating 100's of
Queries using the wizard, is there anyway for me to just change the sql
Where clause at runtime? I have the TableAdapter bound to a...
| |
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
http://svnweb.tuxfamily.org/rss.php?repname=proaudio+%28ckpp%29&path=%2F&rev=0&sc=0&isdir=1
If I use it with a php-script which opens the url with fopen etc.
|
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 statement from an
ObjectDataSource thorugh a strongly typed DataSet DAL:
Failed to enable constraints. One or more rows contain values violating
non-null, unique, or foreign-key constraints.
There are no foreign key constraints on my database, and...
|
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 what this means?
|
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 the code I get....
=======================
Server Error in '/MyCompanyMyProject' Application.
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |