Tag: asp.net-mvc-5

Role provider not working with SQL Server Enterprise

I am getting the following error, The user instance login flag is not supported on this version of SQL Server. The connection will be closed. from the below line of code in my razor view(MVC5) @if(Roles.IsUserInRole(“User”){} I have upgraded my database sql server from Express 2012 to Enterprise 2012 edition . After that I got […]

Get data from local DB not working

I have create MVC5 application and I have local DB ,currently I have entered data to the table and I able to see that in the MDF file under server explorer ->data connections ,now I want to read it via API below and its not working i’ve provided the ID which I have in the […]

I have to tables I want to join them and also want to use group by clause using lambda expression

The below is the SQL query, for this i want to write lambda expression. the entity model for the Enrollment_Policy and Enrollment_MemberPolicy tables is MCEntities. select mp.PolicyId, p.PolicyNo from Enrollment_Policy p inner join Enrollment_MemberPolicy mp on mp.PolicyId=p.ID where mp.UHID=123 group by mp.PolicyId, p.policyNO I got stuck at how to write group by clause. Please some […]

ASP.NET MVC 5, Oracle.ManagedDataAccess and SQL DB

I would like to use a SQL Server database for identity but work with data (crud) in an Oracle database. I can connect to Oracle fine using the Oracle.ManagedDataAccess package. Can anyone guide me as to how to set up the DbContext / whatever? I have set up this in web config: <connectionStrings> <add name=”SQLServerConnect” […]

SignalR Asp.NET MVC5 User Info

I am trying to create a chat application, I want to display the Firstname of the user. However the username is their email, using var userName = HttpContext.Current.User.Identity.Name.ToString(); returns their email. How can I access the Firstname property the model has and the DB has. When they register they have to put in a first […]

There is no ViewData item of type 'IEnumerable<SelectListItem>' that has the key 'Userlist'

My User Model [Key] public int UserId { get; set; } [Required] [DisplayName(“First Name”)] public string FirstName { get; set; } [Required] [DisplayName(“Last Name”)] public string LastName { get; set; } public virtual List<DptCRP> DptCRPs { get; set; } My Patient Model [Key] [Required] [DisplayName(“Registration No”)] public string PatientRegNo { get; set; } [Required] [DisplayName(“Patient […]

Site is Not Working When I connect Local Database In MVC5 Project,

I Have create MVC5 Project. its Working well when its connect server database.after I have created table same database and connected with my project local SQL server configuration. after that Run my Project its showing Error Like this Server Error in ‘/’ Application. Login failed for user ”. Description: An unhandled exception occurred during the […]

How to save file in existing database?

I have a model for my database from SQL Server 2016, and I don’t find my viewmodel as you written to edit the file type to HttpPostedFileBase, so what should I do? This is my model, view and controller Model public partial class HMW_Solution { public int ID { get; set; } public Nullable<int> HMW_ID […]

Update using stored procedure in ASP.NET MVC 5

I have a demo test using a stored procedure to update data from user. Here’s my stored procedure code: ALTER PROC sp_CapNhat @maNV nvarchar(10), @hoNV nvarchar(50), @tenNV nvarchar(100), @gioiTinh bit, @diaChi nvarchar(150), @tienLuong int AS BEGIN UPDATE NhanVien SET Ho = @hoNV, Ten = @tenNV, GioiTinh = @gioiTinh, DiaChi = @diaChi, TienLuong = @tienLuong WHERE […]

Crystal reporting using VS 2015 and MVC5

I’m new in MVC5, i got this error when using Crystal reporting tool, An exception of type ‘System.NotSupportedException’ occurred in System.Data.dll but not handled in user code Additional information: ‘DataSet’ does not support System.Nullable <>. using CrystalDecisions.CrystalReports.Engine; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Web; using System.Web.Mvc; namespace CrystalReportMVC.Controllers { public class CustomerController […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.