Click here to Skip to main content
15,896,207 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi In below, in the first, it created a Model with name : EmpModel, then it said that:
“let us create the table named Employee in the database according to our model fields to store the details”
Why? The EmpModel is a table itself, why we create another table like it?
Second question: is it possible to create stored procedure by MVC (no by SQL Server).

Thanks.

C#
public class EmpModel  
	{  
	    public string Name { get; set; }  
	    public string City { get; set; }  
	    public string Address { get; set; }  
	         
	}  


Step 3: Create Table and Stored procedures.

Now before creating the views let us create the table named Employee in the database according to our model fields to store the details:



Create stored procedure to insert records
Create procedure [dbo].[AddEmp]
(
   @Name varchar (50),
   @City varchar (50),
   @Address varchar (50)
)
as
begin
   Insert into Employee values(@Name,@City,@Address)
End


What I have tried:

i dont know any thinks about this topics.
please help me.

thanks
Posted
Updated 4-Feb-20 5:11am
v2

Model isn't a table: it's a representation of the database table, the data it contains, and the operations you can perform on that table. In fact, the model itself is in effect the representation of a single row in the DB table, not the table itself!

Creating a class in your app doesn't automatically add anything to a database.
 
Share this answer
 
Second question: is it possible to create stored procedure by MVC (no by SQL Server).
This is not really clear. Do you want to issue some SQL commands to your database engine without the graphical MS MSQL server interface?

If so, creating and modifying a stored procedure on a database engine which supports it is just a textual request, as with all other requests. It just have to respect the SQL syntax supported by the database engine:
SQL
CREATE PROCEDURE WhatACoolName ...

If not, then you wil have to rephrase your second question.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900