Skip to main content

Posts

Showing posts from July 13, 2014

Sample MVC database access example source code

step 1-> Create a databse as follows Step 2-> Write stored Procedure for Insertion USE [Guestbook] GO /****** Object:  StoredProcedure [dbo].[spInsert]    Script Date: 07/14/2014 14:29:50 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[spInsert](@Name nvarchar(50),@Message nvarchar(50),@DateAdded datetime) AS BEGIN     Insert into GuestBookEntry(Name,Message,DateAdded) values(@Name,@Message,@DateAdded) END step-> Create Model as using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Data.Entity; using System.Globalization; using System.Web.Mvc; using System.Data.Sql; using System.Configuration; using System.Web.Security; using System.Data.SqlClient; using System.Data; namespace GuestBook.Models {     //public class GuestBookContext : DbContext     //{  ...