Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: MVC4
public class SdSolDBController : Controller
        SdSolDB _db = new SdSolDB();
        public ActionResult Index()
            var model = _db.Categories;
            return View(model);
This is my Controller which is conntecting with my database.
public class Category
        public int CategoryID { get; set; }
        public string CategoryName { get; set; }
        public int EvaluationType { get; set; }
        public string CreatedBy { get; set; }
        public DateTime CreatedDate { get; set; }
These Are my Enities...
public class SdSolDB:DbContext
        public DbSet<Category> Categories { get; set; }
This is my DBcontaxt file...
My database is already exist.
but when i use this code.and give some other test database name it generate new table with name Category in that database.
But i dont need that
i want to use my already created database.
How can i do that???
please help me
and if u have a good vedio tutorial about it.then plz give me a download link also
thanks in advance...
Posted 25-Feb-13 4:53am

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

  Print Answers RSS
0 CHill60 590
1 Sergey Alexandrovich Kryukov 467
2 OriginalGriff 285
3 PIEBALDconsult 285
4 BillWoodruff 173

Advertise | Privacy | Mobile
Web04 | 2.8.141015.1 | Last Updated 25 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100