Search Results

Search found 2 results on 1 pages for 'tgriffiths'.

Page 1/1 | 1 

  • Sql Server 2008 Create Foreign Key Manually

    - by tgriffiths
    I have inherited an old database which wasn't designed very well. It is a Sql Server 2008 database which is missing quite a lot of Foreign Key relationships. Below shows two of the tables, and I am trying to manually create a FK relationship between dbo.app_status.status_id and dbo.app_additional_info.application_id I am using SQL Server Management Studio when trying to create the relationship using the query below USE myDatabase; GO ALTER TABLE dbo.app_additional_info ADD CONSTRAINT FK_AddInfo_AppStatus FOREIGN KEY (application_id) REFERENCES dbo.app_status (status_id) ON DELETE CASCADE ON UPDATE CASCADE ; GO However, I receive this error when I run the query The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK_AddInfo_AppStatus". The conflict occurred in database "myDatabase", table "dbo.app_status", column 'status_id'. I am wondering if the query is failing because each table already contains approximately 130,000 records? Please help. Thanks.

    Read the article

  • ASP.Net MVC 3 Full Name In DropDownList

    - by tgriffiths
    I am getting a bit confused with this and need a little help please. I am developing a ASP.Net MVC 3 Web application using Entity Framework 4.1. I have a DropDownList on one of my Razor Views, and I wish to display a list of Full Names, for example Tom Jones Michael Jackson James Brown In my Controller I retrieve a List of User Objects, then select the FirstName and LastName of each User, and pass the data to a SelectList. List<User> Requesters = _userService.GetAllUsersByTypeIDOrgID(46, user.organisationID.Value).ToList(); var RequesterNames = from r in Requesters let person = new { UserID = r.userID, FullName = new { r.firstName, r.lastName } } orderby person.FullName ascending select person; viewModel.RequestersList = new SelectList(RequesterNames, "UserID", "FullName"); return View(viewModel); In my Razor View I have the following @Html.DropDownListFor(model => model.requesterID, Model.RequestersList, "Select", new { @class = "inpt_a"}) @Html.ValidationMessageFor(model => model.requesterID) However, when I run the code I get the following error At least one object must implement IComparable. I feel as if I am going about this the wrong way, so could someone please help with this? Thanks.

    Read the article

1