16,018,458 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by satyanand mishra (Top 22 by date)
satyanand mishra
30-Jun-20 11:40am
View
Thank you very Much i did it
satyanand mishra
30-Jun-20 6:46am
View
Deleted
I changed that json to xml but still i get same error
satyanand mishra
29-Jun-20 7:50am
View
Thanks for reply
but it's still give same exception [object:Object]
my Web service code is
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
namespace JequeryDemo4
{
///
/// Summary description for EmployeeService
///
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
public class EmployeeService : System.Web.Services.WebService
{
[WebMethod]
public Employee HelloWorld(int employeeId)
{
Employee emp = new Employee();
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["Emp"].ConnectionString);
SqlCommand cmd = new SqlCommand("spGet", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@Id", SqlDbType.Int).Value = employeeId;
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
emp.Id =Convert.ToInt32(dr["Id"]);
emp.Name = dr["Name"].ToString();
emp.City = dr["City"].ToString();
emp.Salary =Convert.ToInt32(dr["Salary"]);
}
return emp;
}
}
}
satyanand mishra
11-Apr-20 23:40pm
View
I checked everything is fine but It's still give same error the element wev.server has invalid child element
satyanand mishra
11-Apr-20 14:10pm
View
Thanks for Reply I did but it's still give Error in my web Config file
The Element Web.Server has invalid child element rewrite .I am using Visual Studio 10 and IIS 8.5
satyanand mishra
25-Mar-20 22:01pm
View
sir thank you for posting this answer but I want to get dynamic server name and instance of
sql server 2014 how would I do.
satyanand mishra
25-Mar-20 7:29am
View
Can you help me in this question
satyanand mishra
1-Sep-19 8:49am
View
but 6 pages connected with a single menu then how it's possible
satyanand mishra
30-Aug-19 8:56am
View
I have a 6 page then I want to make a two panel admin panel and user panel then I have single login page but when admin enter user id and password then he access only two page and user enter id and password then he access four page .then please tell me how many table i make in database and how can i do this .
satyanand mishra
29-Aug-19 10:23am
View
Deleted
thanks for suggestion i have a book i learn many time
satyanand mishra
29-Aug-19 10:21am
View
it's condition
satyanand mishra
10-Mar-19 6:23am
View
I know this but I want to do this SqlAdapter through Update command I don't want to open my connection,can you explain it why it's give exception.
satyanand mishra
12-Apr-18 10:20am
View
Thank You very much Sir For Giving me suggestion finally I resolve the problem.
satyanand mishra
9-Apr-18 8:52am
View
HomeController Code is=>
----------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MvcApplication7.Models;
namespace MvcApplication7.Controllers
{
public class HomeController : Controller
{
//
// GET: /Home/
public ActionResult Index()
{
try
{
HomeContext homecontext = new HomeContext();
Home home1 = homecontext.home.Single(emp => emp.EmployeeId == 1);
return View(home1);
}
catch (Exception ex)
{
return View(ex);
}
}
}
}
--------------------Model Code--------
First Model Is Home.cd----------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
namespace MvcApplication7.Models
{
[Table("tblHome")]
public class Home
{
[Key]
public int EmployeeId { get; set; }
public string Name { get; set; }
public string City { get; set; }
public string Gender { get; set; }
}
}
---------------------Second Model Is- HomeContext.cs-----------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
namespace MvcApplication7.Models
{
public class HomeContext:DbContext
{
public DbSet<Home> home { get; set; }
}
----------------And My View Code is-----------------
@model MvcApplication7.Models.Home
@{
Layout = null;
}
<!DOCTYPE html>
<meta name="viewport" content="width=device-width" />
<title>Index
EmployeeId:- @Model.EmployeeId
Name:-@Model.Name
City:-@Model.City
Gender:-@Model.Gender
------And My Connection String-------------
<connectionstrings>
<add name="HomeContext" connectionString= "server=SATYA\SAT;database=employee; integrated security=SSPI;" providerName="System.Data.SqlClient"/>
And -----------GlobalFile.asax.cs file code is---------------------
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
Database.SetInitializer<mvcapplication7.models.homecontext>(null);
WebApiConfig.Register(GlobalConfiguration.Configuration);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
}
I want to get data from database on view
but it's give exception like
------------------------------------------------------------------
Server Error in '/MvcApplication7' Application.
The model item passed into the dictionary is of type 'System.Data.Entity.Core.EntityException', but this dictionary requires a model item of type 'MvcApplication7.Models.Home'.
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.InvalidOperationException: The model item passed into the dictionary is of type 'System.Data.Entity.Core.EntityException', but this dictionary requires a model item of type 'MvcApplication7.Models.Home'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: The model item passed into the dictionary is of type 'System.Data.Entity.Core.EntityException', but this dictionary requires a model item of type 'MvcApplication7.Models
satyanand mishra
8-Apr-18 12:40pm
View
I correct it but i get still same exception
satyanand mishra
8-Apr-18 8:41am
View
You are very right sir I am using Entity framework but When I run this code:{
HomeContext homecontext = new HomeContext();
Home hom= homecontext.home.Single(emp => emp.EmployeeId == 1);
return View(hom);}
and my model code is
{
public DbSet<home> home { get; set; }
}
and
{[Table("std")]
public class Home
{
[Key]
public int EmployeeId { get; set; }
public string Name { get; set; }
public string City { get; set; }
public string Gender { get; set; }
}
and view code is
{
EmployeeId:- @Model.EmployeeId
Name:-@Model.Name
City:-@Model.City
Gender:-@Model.Gender
}
and my connection string is
{
<connectionstrings>
<add name="HomeContext" connectionString= "server=SATYA\SAT;database=student; integrated security=SSPI;" providerName="System.Data.SqlClient"/>
}
and
{
this code on global.asax file
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
Database.SetInitializer<mvcapplication7.models.homecontext>(null);
WebApiConfig.Register(GlobalConfiguration.Configuration);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
}
}
It's give exception like
{An error occurred while executing the command definition. See the inner exception for details.}
{
Server Error in '/' Application.
The model item passed into the dictionary is of type 'System.Data.Entity.Core.EntityCommandExecutionException', but this dictionary requires a model item of type 'MvcApplication7.Models.Home'.
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.InvalidOperationException: The model item passed into the dictionary is of type 'System.Data.Entity.Core.EntityCommandExecutionException', but this dictionary requires a model item of type 'MvcApplication7.Models.Home'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: The model item passed into the dictionary is of type 'System.Data.Entity.Core.EntityCommandExecutionException', but this dictionary requires a model item of type 'MvcApplication7.Models.Home'.]
System.Web.Mvc.ViewDataDictionary`1.SetModel(Object value) +378
System.Web.Mvc.ViewDataDictionary.set_Model(Object value) +47
System.Web.Mvc.ViewDataDictionary..ctor(ViewDataDictionary dictionary) +614
System.Web.Mvc.ViewDataDictionary`1..ctor(ViewDataDictionary viewDataDictionary) +37
System.Web.Mvc.WebViewPage`1.SetViewData(ViewDataDictionary viewData) +98
System.Web.Mvc.WebViewPage.set_ViewData(ViewDataDictionary value) +38
System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +425
System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +382
System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +431
System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +39
System.Web.Mvc.<>c__DisplayClass1a.<invokeactionresultwithfilters>b__17() +74
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +388
System.Web.Mvc.<>c__DisplayClass1c.<invokeactionresultwithfilters>b__19() +72
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult
satyanand mishra
19-May-15 5:37am
View
actually sir..
i don,t want use repeater
satyanand mishra
18-May-15 4:17am
View
I want to make a jquery dynamic slider but i don't want to use repater.
satyanand mishra
16-May-15 8:12am
View
thanks ................
but how can i create paging inrepeater.............
satyanand mishra
14-May-15 7:35am
View
wow realy nice
satyanand mishra
8-May-15 8:36am
View
I am just simply create a database in ms sql server 2008 r2 like employee. after then i am create windows application in visual studio 2010 .after then i want to make exe of my application .problem is how can i attached this database file
satyanand mishra
7-May-15 8:03am
View
yes but how can i do
Show More