.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Post New Web Links

ReportViewer :: Failed to enable constraints. But my statement is valid!!

Posted By:      Posted Date: August 21, 2010    Points: 0   Category :ASP.Net
  • A
  • n error has occurred during report processing.
      • Exception has been thrown by the target of an invocation.
        • Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.

    Why do I keep getting this error, even when not using any data on the report. When I run the query in SQL server I get a resultset. However when I try to render the report I get this error.


    View Complete Post

    More Related Resource Links

    Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign

    Using Visual Studio with MySQL.In my XSD dataset I created a query. It runs perfect. I can preview the data fine.In my BLL I wrote code (see below) to retrieve the query results and I'm getting...Using db As New dsDemoTableAdapters.DemoTableAdapter Dim dt As New DataTable dt = db.GetDemo(DemoId) ' ERROR HAPPENS HEREFailed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.Why would previewing the data work but in code it fails?Any ideas?

    failed to enable constraints error




    I am getting below error when trying to display list of providers, i really appreciate feedback on troubleshooting and fixing it.



    Server Error in '/testload' Application.

    Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Data.ConstraintException: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.

    Source Error:

    Line 4828:            End If
    Line 4829:            Dim dataTable As hivsystem.providersDataTable = New testloadsystem.providersDataTable
    Line 4830:            Me.Adapter.Fill(dataTable)
    Line 4831:            Return dataTable
    Line 4832:        End Function

    Login is valid, but server access failed. Windows App can't login unless assigned SysAdmin.


    I put a similar plea for help in the ADO forum but haven't gotten responses. I have a feeling this is a better place to put this post. If someone thinks it should go elsewhere please let me know.

    I've been stuck on this problem for a day and a half. I wrote a windows form application in C# that works flawlessley for myself and the other network admins. As soon as a normal user tries to use it it fails.

    Our environment has XP workstations. SQL Server 2005 Enterprise Edition, on Windows 2003 server.

    My application makes several connections but I wrote it so that it would test and give give meaningful error mesages every time it tried to connect to SQL server. The very first connection it tries to make fails, which thankfully forces the application to exit before ay other connections are made. This first piece is very simple. It runs a stored procedure that adds the user name and the current time to a table. For normal users, I instantly get the error "Login failed for Domain\User". When I looked at the SQL Server logs, I see [Error :18456, Severity:14, State: 11.] which is telling me that the Login is valid, but server access failed.

    We suspected it was a domain rights issue since the network admins can run the aplication successfully, but as it turns out the network admins and developers all have the SQL role "sysadmin". If

    Login is valid, but server access failed. Windows App can't login unless assigned SysAdmin.


    I'm not sure if this belongs here or in a SQL Server forum.  It's an ADO.NET application though so I'm posting it here first.

    Here is our environment.  XP workstations.  SQL Server 2005 Enterprise Edition, on Windows 2003 server.

    We are putting together our first C# windows-based SQL application.  We want to install it on 50 to 100 workstations.  The first piece is very simple.  It starts by running a stored procedure which adds the user name and the current time to a table.   

    If I put a test user into the SQL Server role [sysadmin] it works flawlessly.  If the user is not assigned that role I get the error "Login failed for Domain\User".  When I looked at the SQL Server logs, I see [Error :18456, Severity:14, State: 11.] which is telling me that the Login is valid, but server access failed.  Obviously, I don't want to give all our users sysadmin rights.


    Essentially, we're trying to figure the minimum security settings that will allow our windows users to read, write, and delete from tables in a database, and execute stored procedures.  We thought we understood the security settings but we're missing something.  I don't know how to start with "sysadmin" and remove priveleges one at a time.

    Here are a few things w

    Using a CompareValidator to check input is a valid date

    The CompareValidator can do more than just compare two controls. You can also compare it against several of the main .net data types such as Date, Integer, Double and Currency.

    To do this you would set Operator="DataTypeCheck" and instead of setting the ControlToCompare or ValueToCompare attributes as you normally would you use the Type="Date" (or any of the data types I have listed above).

    How Do I Enable Inline GridView Editing?

    Now that you have created a site with Edit and Details views, how do you enable inline editing in a GridView control? This video shows you how, and also touches on routing.

    Passing Linq Statement between master and content page


    I usually work with windows forms, and am just starting to work with ASP.Net, so appologies if this is a dumb question!

    I have a master page which has a search button on it. The results of this are built up using a Linq statement and if there are any results, I want to display the results in a contents page.

    On the masterpage, I have the following code:

    Private _res
        Public Overridable ReadOnly Property SearchRes()
                Return _res
            End Get
        End Property
     Private Sub DoSearch()
       'some code to get a linq result
        If res.Any Then
                _res = res
                Server.Transfer("SearchResults.aspx", True)
                'no results
                LabelNoRes.Visible = True
            End If
     End Sub

    On the SearchResults.aspx page I have this code.

    Dim m As pxSite = CType(Page.Master, MasterPage)
            If m.SearchRes IsNot Nothing Then
                Label1.Text = "Results found = " & m.SearchRes.Count
            End If

    m.searchRes is always nothing. 

    What am I doing wrong here?


    Gridview Enable Selection Problem



    I have a gridview with Enable selection and Enable Paging equals to TRUE.

    I also set the PageSize of my gridview to 4 so that I only displays 4 rows per page.

    The problem is when I click the pager in the bottom of my gridview, my gridview is disappearing and no records appear.

    Here is code behind of my gridview:

    If e.Row.RowType = DataControlRowType.DataRow Then
                    e.Row.Attributes("style") = "cursor:pointer"
                    e.Row.Cells(2).Attributes.Add("onclick", Page.ClientScript.GetPostBackEventReference(sender, "Select$" & e.Row.RowIndex.ToString))
                    e.Row.Cells(3).Attributes.Add("onclick", Page.ClientScript.GetPostBackEventReference(sender, "Select$" & e.Row.RowIndex.ToString))
                    e.Row.Cells(4).Attributes.Add("onclick", Page.ClientScript.GetPostBackEventReference(sender, "Select$" & e.Row.RowIndex.ToString))
                    e.Row.Cells(5).Attributes.Add("onclick", Page.ClientScript.GetPostBackEventReference(sender, "Select$" & e.Row.RowIndex.ToString))
                    e.Row.Cells(6).Attributes.Add("onclick", Page.ClientScript.GetPostBackEventReference(sender, "Select$" & e.Row.RowIndex.ToString))

    Sys.Net.WebServiceFailedException: The server method '' failed with the following error:



    Let's say we have 2 time consuming functions, aaa and aaa1 inside a aspx page.

            public static string aaa(int i)
                return i.ToString();
            public static string aaa1(int i)
                return i.ToString();



            <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
            <span id="displayspan"></span>
            <br />
            <input type="button" value=

    WebMatrix conversion failed when converting from a character string to uniqueidentifier?


    I am trying to retrieve xml from a small function in my .cshtml page. Its throwing me an error. This however, runs fine in a console/form environment.

    It takes 3 parameters and 1 exception.

    myDll.GetXML(year, username, uniqueidentifier, out ex);

    When I run this page I get the error, "Conversion failed when converting from a character string to uniqueidentifier."

    Or a stack of.

    System.Data.SqlClient.SqlException (0x80131904): Conversion failed when converting from a character string to uniqueidentifier.
       at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
       at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
       at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
       at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
       at System.Data.SqlClient.SqlDataReader.get_MetaData()
       at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
       at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBeha

    Failed to create AppDomain


    Recently updated my system to use Visual Studio 2010, and projects will no longer compile. All of them give the error "Failed to create AppDomain." Intellisense does not work either (except for standard HTML tags), and individual pages will also not compile.

    Points of note:

    • All sites are hosted on UNC shares (although it doesn't work on a new site created on local drive either)
    • Language is mostly C#
    • No explicit code is creating AppDomain objects
    • Sites compiled fine under both VS 2005 and 2008 both before and after VS 2010 installation
    • Sites compile and run fine from the IIS server on the remote machines (one IIS 6, one IIS 7)

    Things I've tried (some obviously shouldn't have any bearing on it, but I've tried just about everything that anyone suggested on any forum I could find, most of which seemed to apply to IIS, not VS):

    • renaming/deleting security.config
    • running caspol -reset
    • re-registering asp.net: aspnet_regiis.exe -ua / aspnet_regiis.exe -i
    • removing VS 2005, 2008, 2010, and then re-installing just VS 2010
    • adding the UNC path to the local intranet zone (internet options control panel)
    • adding the UNC path to LocalIntranet_Zone in the ASP.Net 2.0 control panel (runtime security policy/machine/al

    helped needed: ASP LDAP authentication failed in IE 8


    I use the following code to do the user authentication through Active Directory using LDAP.

    entry = new DirectoryEntry("LDAP://" + server, user_name, password);
    if (!string.IsNullOrEmpty(entry.Name))
    EmployeeNetId = entry.Username.Substring(0, 3);

    // Retrieve EmployeeId, and Employee Full Name
    EmployeeId = -1;

    It works for Chrome, Firefox with no problem. But with IE 8, it works sometimes, and failed on some computers. When it failed, I figured that I need to check SSL 2.0 in IE 8 Internet Options.  It's weird because in those computers that IE 8 works, SSL 2.0 is also unchecked.

    Am I using some deprecated method? Or How do I specifiy the SSL version options in the LDAP connection?

    WCF The Security Support Provider Interface (SSPI) negotiation failed


    I am using a wcf service that I created, when both hosting machine and the client machine are on the same domain everything works just fine. When I publish the client app to the webserver in the DMZ I am getting the following error:

    SOAP security negotiation with '' for   
    '' failed. See inner exception  
    for more details.The Security Support Provider Interface (SSPI) negotiation failed.

    Here is my service main where I set up the service


     Uri baseAddress = new Uri("Http://");
          ServiceHost selfHost = new ServiceHost(typeof(QBService), baseAddress);

    Intermittant error: "A connection attempt failed because the connected party did not properly respon



    I'm having a doozy of a problem, and can't find a solution.  I have a WFC Web Service installed to a pair of servers, and accessed through a load balancer.  I am accessing the service from an ASP.NET client app, also via WCF.  The Client is not load balanced.

    I'm getting an intermittant error:

    (Inner Most Exception) System.Net.Sockets.SocketException:  A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond x.x.x.x:80

    (Middle Exception) System.Net.WebException: Unable to connect to the remote server

    (Outer Exception) System.ServiceModel.EndpointNotFoundException:  Could not connect to http://<MYSite>/<MYApp>/<MYService>.svc. TCP error code 10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond x.x.x.x:80.

    I can reproduce this error with about 20% reliability if I execute the exact same page request on the client from 2 browsers at the same time.  When the problem occurs, the successful p

    Security negotiation failed because the remote party did not send back a reply in a timely manner. T



    Dear All i have created one simple service

    like this

    namespace WcfService2
            public class Service1 : IService1
            public string ShowEmpName(string strFirstName, string strLastName)
                return strFirstName + strLastName;

    after executing in .net command promt i got 2 files

    service.cs & output.config

    after that i create one class file like this

    namespace WcfService2
        public class clientcs

            static void Main(string[] args)
                Service1Client client = new Service1Client();
                string strResult = client.ShowEmpName("Pradeep", "Deokar");

    CLSID {00024500-0000-0000-C000-000000000046} failed with error: 80070005


    Hi Guys,

    I know the Microsoft do not support to automate office products. But still i am able to do that with Excel. I did some changes in registry and DCOM confing. Then i am able to open and edit excel on server machine.

    Before doing this changes i was getting following error

    Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005.

    After doing registry changes problem is resolved.

    I followed steps given by Smith in



    But when i deployed my application on Win Server 2008 and calling from client then i am getting following same error as above


    Please help me


    Santosh J.


    Build succeeded but still shows as failed.


     I am able to run a build successfully on just the web site, but when i add the deployment project it shows failed (see below) but in the details it says build succeeded for the WDP build portion...so I am stumped as to by I am getting a failure. any ideas? I have set the build output to "Diagnostic" and dont see any failures or errors...so is there anything else i can do to find the problem?


    Build succeeded.

    Time Elapsed 00:00:21.71
    ------ Skipped Rebuild All: Project: AdminToolHelp, Configuration: Debug Any CPU ------
    Project not selected to build for this solution configuration
    ========== Rebuild All: 1 succeeded, 1 failed, 1 skipped ==========

    ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
    Sql Server  SharePoint  Silverlight  Others  All   

    Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend