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

Top 5 Contributors of the Month
Imran Ghani
Sohaib Khalid
Post New Web Links

Defining Constraints - SRS or SDD?

Posted By:      Posted Date: September 30, 2010    Points: 0   Category :ASP.Net

Where should I define any application/database level constraint - In the Software Requirement Spefications (SRS) or Software Design Document SDD. e.g. An EmployeeID is unique OR If we update a particular value, a log entry is made. And in the respective SRS or SDD, any particular section?

View Complete Post

More Related Resource Links

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

  • 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.


    Data Points: Disabling Constraints and Triggers


    What to do when you need to disable triggers and constraints to perform data synchronization and other tasks with an offline database.

    John Papa

    MSDN Magazine April 2007

    Defining session variables...



    This is a pretty basic question.

    I have some code where I need to define a session variable  however it's coming back as Nothing when the code is executed. Here's the code:

    ' Default Currency
    REQCURR = Request.Querystring("p_DCURR")
    'If not explicitly specified, try to get it from session
    If (REQCURR = "") Then
         If (Session("REQCURR") <> "") Then
              REQCURR = Session("REQCURR")
              'Here is the session variable I'm trying to define:
              Session("REQCAD") = 0
              REQCURR = ""
         End If
    End If
    Session("REQCURR") = REQCURR

    So, for some reason that Session("REQCAD") = 0 has no value instead of having a value of 0.

    Any thoughts?


    How to script default constraints using SMO

    I have developed a db copy tool using smo and the only thing that I cannot get to work is the transfer of a default constraint. We have two types of copies. Full and clean. The full is one might expect a simple backup and restore. A clean is a db built from scratch transfering the schema and then data for a subset of tables. It is the clean copy where I cannot get the default constraint to work. I hope I am just missing setting an option. Code is as follows:   Transfer cleanCopySchema = new Transfer(sourceDatabase); cleanCopySchema.CopyAllTables = true; cleanCopySchema.DropDestinationObjectsFirst = true; cleanCopySchema.Options.IncludeIfNotExists = true; cleanCopySchema.Options.WithDependencies = false; cleanCopySchema.Options.ContinueScriptingOnError = true;   cleanCopySchema.CopyData = false; cleanCopySchema.CopyAllUserDefinedFunctions = true; cleanCopySchema.CopySchema = true; cleanCopySchema.DestinationServer = destinationServer.Name.ToString(); cleanCopySchema.DestinationLoginSecure = true; cleanCopySchema.DestinationDatabase = request.DestinationDatabaseName; cleanCopySchema.CopyAllUsers = false; cleanCopySchema.CopyAllLogins = false; cleanCopySchema.CopyAllStoredProcedures = true; cleanCopySchema.CopyAllViews = true; cleanCopySchema.Options.DriAll = true; cleanCopySchema.Options.Indexes = true; cleanCopySchema.Options.DriDefaults = true; cle

    Defining a custom style for a derived DataGrid

    Hi all, Please tell me what I could be missing here. I am trying to define a very basic style for a derived DataGrid and it doesn't seem to take! In my dll project, I have this in the Generic.xaml: <Style TargetType="{x:Type local:MyDataGrid1}" BasedOn="{StaticResource {x:Type DataGrid}}"> <Setter Property="RowBackground" Value="#AAEAEFF4"/> <Setter Property="AlternatingRowBackground" Value="#00FFFFFF"/> </Style>  .. and this is how the derived grid is currently (pretty empty until I have this figured out): public class MyDataGrid1 : DataGrid   {     static MyDataGrid1()     {       DefaultStyleKeyProperty.OverrideMetadata(typeof(MyDataGrid1), new FrameworkPropertyMetadata(typeof(MyDataGrid1)));     }   } And in my Sample App's MainPage.xaml, I simply have this: <mygrids:MyDataGrid1 x:Name="dataGrid1" /> But, the alternating colors are not applied! Interestingly, in debugger I see that the properties are set to these values in this instance, but the for some reason while rendering, these values were not used! Please help. Thanks

    SSRS 2008 R2 Data Source View Wizard does not recognize unique key constraints on views when using O

    Hi, SSRS Data Source View Wizard does recongnize Primary/Foreign Key relationships from oracle datasouce tables, but does not recognize unique key constraints on views. How can I solve this problem. Thanks

    defining dataset (Visual Studio 2008)

    hii alli need to prepare a report as  a table. but my table needs to contain data from two schemas. so my doubt is, is it possible to set two dataset names for a table in its property?

    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?

    WPF Designer crashes when defining x:Key in a resource

    I have an xbap application with the following xaml file: <UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Name="Screen_1_1_Name" xmlns:z="clr-namespace:EmployeeExpenseReportsFileUploadWPFScreens" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="EmployeeExpenseReportsFileUploadWPFScreens.FileUploadScreen" Width="640" Height="480"> <UserControl.Resources> <z:ConcurFileList ></z:ConcurFileList> </UserControl.Resources> <Grid x:Name="LayoutRoot" Background="White"> <Label Content="Employee Expense Reports - File Upload" HorizontalAlignment="Left" Margin="190,12,0,0" VerticalAlignment="Top" FontStyle="Italic" FontWeight="Bold"/> <TextBox x:Name="FilePathTextBox" Height="23" Margin="34,51,150,0" TextWrapping="Wrap" Text="Please Select A File ..." VerticalAlignment="Top" FontStyle="Italic"/> <Button x:Name="BrowseButton" Content="..." Horizonta

    Route Constraints

    If I have a route mapped as follows, how can I add a constraint for the route values with periods in?routes.MapRoute( "", "Created/{Created.Year}/{Created.Month}/{Created.Day}/Page/{Page}", new { controller = "Blah", action = "Blah" }, new { Page = @"\d+" });

    Defining bondaries of Windows Form

    Hi! I am developing a windows form Application where I provide the functionality for users to move the controls around on the form. I have already written that code and it works fine. The problem I am facing is whenever you drag your controls outside the 'East' and 'South' border of any windows Form you loose the control or to say it goes into other screen position which is not visible in your current form size. Yes, I know we can resize the Form and find our lost control back but I want some way in which we can prevent these control to be dragged out of the current form Size in the first place. Any help will be much appreciated!! Thanks. Sunny

    Defining Validation rules with Data annotations - ???


    I am having following problem:

    Defined RegisterModel class - with some validation rules for creating new users, and this works fine.

    Then I get this class, strip few properties and wanted to reuse it as UserInfo_Form_Model,   for editing user properites.

    No changes, just deleted few items, renamed and reused in strongly typed View for editing.

    And result of validation is: -

    [DisplayName("Name")] works fine, showing correct

    [StringLength(20, ErrorMessage = "xxxx...")] - not working, no message showed when suppose to be one

    [Required(ErrorMessage = "xxxx.")] - not working, not showing messages when delete required values?

    but  (ModelState.IsValid) is false when I checked it in controller (it had to be because required value is missing)?

    Is it this only partially correct and how this can be?

    Well this is a bit frustrating because it cant be simpler than this and I cant make this simple code reuse. :|

    Quite a few gotchas I already found or I am coding completely wrong.

    Defining uniqueness of a record with combination of IDs



    My question may be trivial but I just have a hard time abstracting table relationships :P

    I have 3 tables:

    [] -> primary key

    Datas: [ID], Data
    DataValues: DataID, ValueTypeID, Value
    ValueTypes: [ID], Name

    The first is the main table;
    The second is an value-attributing table and reason of this topic;
    The third is the value type definer;

    The problem is as follows:
    I want to be sure on this low-level model that ONE ValueType record only gets refferenced by ONE Data record.

    Datas: ID -> 27, Data -> "Some Data"
    ValueTypes: ID -> 14, Name -> "Length"
    DataValues: DataID -> 27, ValueTypeID -> 14, Value -> 9

    I want not to be possible to add another record in DataValues with DataID = 27 AND ValueTypeID = 14
    It should allow, though, DataID = 27 AND ValueTypeID = 18 or DataID = 65 AND ValueTypeID = 14, for example.

    Thank you,

    Matheus Simon.

    Please Help with Defining Calculated Measure based on Dimension Members



    The issue looks pretty simple yet I got stuck. I want to define the measure [NR Var] as [NR]-[F NR] for years/months/dates before 2009 and [NR]-[FI NR] for 2009 and on. I am using [Year]-[Month]-[Date] hierarchies in the cube. I have defined scope:

    Scope ([Measures].[NR Var], {
    descendants([Date].[Year - Month - Date].[Year].&[2004], 2, self_before_after),
    descendants([Date].[Year - Month - Date].[Year].&[2005], 2, self_before_after),
    descendants([Date].[Year - Month - Date].[Year].&[2006], 2, self_before_after),
    descendants([Date].[Year - Month - Date].[Year].&[2007], 2, self_before_after),
    descendants([Date].[Year - Month - Date].[Year].&[2008], 2, self_before_after)});
    this=[NR]-[F NR];
    End Scope;

    but it does not work for some reason. If I get rid of DESCENDANTS function, it works but applies the scope only to the YEAR level. Another problem with using SCOPE is that it affects [NR Var] only yet I have other calcs derivative of [NR Var] which I want the scope to affect as well.

    So I ideally I would like to have something like:



    case when {
    descendants([Date].[Year - Month - Date].[Year].&[2004], 2, self_before_after),
    descendants([Date].[Year - Month - Date].[Year].&[2005], 2, self_befor

    can we use optional params in C# while defining service contracts?


    I mean can I do something like this:

    List<String> GetEmployees(String EmployeeId,  String DepartmentID= "00");

    and then implement it the same way as below

    List<String> GetEmployees(String EmployeeId, String DepartmentID= "00")




    I tried this, but it didn't work. Its always expecting DepartmentID when I tried to use invoke 'GetEmployees' using service reference.

    Creating table records with foreign key constraints/Separate controllers?


    I have multiple tables that are all linked back to a central table with foreign keys. I want to be able to create a new record in table 2, but I'm having trouble because I don't know how to create a new instance of table 2's record while referencing the ID of the record it will be tied to.


    Defining a regular expression in the application settings xml file.


    I have a little question about application settings. I have a regular expression in my code which should be customizable by the user so I made an application setting for it.  The regular expression is used in a class in the project and has the following value

    Dim email_regularex As String

    So now I made a new Settings file in my project and gave the following value for this string in the settings file:



    So when i do this in Visual Studio 2008, Visual Studio automatically creates a app.config xml file with the right settings in it.

    But when I start my application and use the regular expression like this:

     myMatch As
     Match = Regex.Match(email, email_regularex)
     myMatch.Success Then
     MsgBox("Please enter a valid email address like: iiiiii@iii.com"
    , MsgBoxStyle.Critical)

    the application break

    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