This is model class file:- using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace MVC.Models { public class Idetails { private int Id; private string Name; private string City; public int id { set { Id = value; } get { return Id; } } public string name { set { Name = value; } get { return Name; } } public string city { set { City = value; } get { return City; } } } } This is the controller file:- using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using MVC.Models; using System.Data.SqlClient; using System.Data; namespace MVC.Controllers { public class DetailsController : Controller { // // GET: /Details/ public ActionResult det() { Idetails i = new Idetails(); SqlConnection con = new SqlConnection("Data Source=PRABAKARAN\\SQLEXPRESS;Initial Catalog=master;Integrated Security=True"); con.Open(); SqlCommand cmd = new SqlCommand("insert into ct values("+i.id+",'"+i.name+"','"+i.city+"')", con); cmd.ExecuteNonQuery(); return View(i); } } } In that views i dont know how to write the query in design page because the code page is not open.. please help me to solve this..
Model dot
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)