Part 6- ASP.NET MVC Database Connection Using Entity Framework | Connect to SQL Server database

  Рет қаралды 185,670

Technotips Ashish

Technotips Ashish

Күн бұрын

Пікірлер: 149
@aapkanigam
@aapkanigam 6 жыл бұрын
Click on thumbs up🖒 button if you like this video. 👉Subscribe our channel for real time MVC videos. And don't forget to 👉share this😁 Thanks💖
@amanjutt1591
@amanjutt1591 6 жыл бұрын
hello sir I am following you you are doing well I have a little confusion can you help me?
@itsumokokoro5166
@itsumokokoro5166 7 жыл бұрын
The test connection alert sound 3:35 , shocked me.
@aapkanigam
@aapkanigam 7 жыл бұрын
+Iicir Yves Exiomo I was also shocked while making this video
@49NICOW
@49NICOW 7 жыл бұрын
I think i'm dead too
@ronjones1587
@ronjones1587 5 жыл бұрын
my hair stood up that time
@LetCode96666
@LetCode96666 5 жыл бұрын
I just shit myself lol XD
@kiennhanmeffu2678
@kiennhanmeffu2678 3 жыл бұрын
Can you explain me actually what happening here from 8.19
@mohanmani4245
@mohanmani4245 2 жыл бұрын
HOW TO GET MULTIPLE DATA IN DB CONECTIION
@sohailakbar7577
@sohailakbar7577 3 жыл бұрын
Nice video. Easy to understand.
@CommanDoHighTech
@CommanDoHighTech 5 жыл бұрын
for every one how have Exception in (x=>x.ID) you make the relationship in a wrong way you will make relation between Department Table and Employee the foregin key will be in the table employee CREATE TABLE [dbo].[Employee] ( [ID] INT IDENTITY (1, 1) NOT NULL, [name] NVARCHAR (MAX) NULL, [Dep] INT NULL, [addr] NVARCHAR (20) NULL, PRIMARY KEY CLUSTERED ([ID] ASC), FOREIGN KEY ([Dep]) REFERENCES [dbo].[Department] ([DepID]) ); or in the sql query you will make it departmentID int references Depatment(DepID)
@vishnuc4661
@vishnuc4661 Жыл бұрын
Hi, ashish actually in mac os sql server studio management is not avilable ,can u suggest any free alternatives
@dharmenderkapil
@dharmenderkapil 4 жыл бұрын
I didn't Understand the Part 5 of mvc it was not so cool Sorry!!!! :( :(
@ElPeppito
@ElPeppito 3 жыл бұрын
3:34 jesus fucking christ i almost had an heart attack
@bhaskarkholiya8125
@bhaskarkholiya8125 6 жыл бұрын
Hi, i can't see Generating from database option in ADO.NET Entity Data Model. Please help i am using ms sql server 2008 and visual studio 2015
@hamzahahmed8657
@hamzahahmed8657 3 жыл бұрын
Thank you, bro
@ewomaanthony3655
@ewomaanthony3655 7 жыл бұрын
Am having this error Error CS0029 Cannot implicitly convert type 'MVCTutorial.Models.tblEmployee' to 'MVCTutorial.Models.Employee'
@iftikharhussain1823
@iftikharhussain1823 4 жыл бұрын
how to create forign key between employee and department tables
@aapkanigam
@aapkanigam 4 жыл бұрын
Part 26 can help you
@Abedi000
@Abedi000 7 жыл бұрын
Very helpful video - I suggest try to drink some water beforehand so we don't hear your mouth while talking
@aapkanigam
@aapkanigam 7 жыл бұрын
+Christopher thanks for ur suggestion .. the mic was so closure to my mouth .. and did not have idea about quality ..but no worry .. after part 10 you will find good experience
@kirankumari-nz8lr
@kirankumari-nz8lr 7 жыл бұрын
Thanks it helped me a lot. Loved you series.
@trr5088
@trr5088 8 жыл бұрын
Ashish, your name indicates a blessing and your help has indeed been that for me. On to number 7
@aapkanigam
@aapkanigam 8 жыл бұрын
+TR Rooks keep it up !
@mattgrannen2
@mattgrannen2 Жыл бұрын
Thank you Ashish: You saved me a lot of time
@fariatam9153
@fariatam9153 7 жыл бұрын
hello,nice videos :) but im facing difficulties while creating entity model from database which is on 2.40.i dont have the option "Generate from database".I used visual studio 2017 as i didn't find 2013 version anywhere.how to solve this problem?
@trr5088
@trr5088 8 жыл бұрын
Ashish, I am starting Part 6 - Asp.net MVC Database. Should this be a new project? Before we have always built on previous lesson.
@aapkanigam
@aapkanigam 8 жыл бұрын
+TR Rooks (TRR) no need to create new project .you can work on same controller .just create one more method and start . Technotips now on fb .you can visit fb.com/technotipstutorial .please share videos among your friends and help them too.thanks
@erfanmehrvash
@erfanmehrvash 7 жыл бұрын
Hi Sir, Is it possible, share the code? Because I have some error like The name 'model' does not exist
@sanaullah-my2tm
@sanaullah-my2tm 6 жыл бұрын
sir i am getting error in view when i want to write @model mvctutoral.models.EmplyeeViewModel then it is showing error the type name models does not not exst in system.web.mvc please solve my problem
@aapkanigam
@aapkanigam 6 жыл бұрын
Name is case sensitive
@faizakhan6724
@faizakhan6724 7 жыл бұрын
It's giving me the following error: The parameters dictionary contains a null entry for parameter 'id' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult Index(Int32)' in 'WebApplication1.Controllers.EmployeeController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter. Parameter name: parameters
@aapkanigam
@aapkanigam 7 жыл бұрын
+Faiza khan in you db table the id column can not accept null value. If id column having primary key then also make it auto incremental. When new entry is save the id will automatically increased. For making auto increment watch part 26 . It will also help you to create new table with relationship with other.
@faizakhan6724
@faizakhan6724 7 жыл бұрын
oka Sir will try it again... Thanks for replying
@nguyentamtoan
@nguyentamtoan 6 жыл бұрын
why do you have to create class EmployeeViewModel? no EmployeeViewModel, the application is Ok.
@aapkanigam
@aapkanigam 6 жыл бұрын
No, it will create lots of problem .. your view will be tightly coupled with entity classes. If you refresh your Entity framework after having any change to db schema, your view will be impacted
@meghamisra5622
@meghamisra5622 7 жыл бұрын
error in this line Employee employee = db.Employees.SingleOrDefault(x => x.ID == 1); An exception of type 'System.Data.Entity.Core.MetadataException' occurred in EntityFramework.dll but was not handled in user code Additional information: Schema specified is not valid. Errors: The relationship 'Test_TrainingModel.FK_Documents_Employees' was not
@aapkanigam
@aapkanigam 7 жыл бұрын
+Megha Misra I think problem is in your table relationship in db . Make sure you have properly updated you edmx file with latest changes in your db table . Part 26 and 25 will help you to do this.
@faizakhan6724
@faizakhan6724 7 жыл бұрын
Sir same error in my code... I have done it two times but same error... :( Any suggestions?
@narendarsingh4672
@narendarsingh4672 6 жыл бұрын
great
@SanjayKumar-hc6iu
@SanjayKumar-hc6iu 7 жыл бұрын
Hi Ashish...I am Unable to create relationship in "MVTutorial.edmx" file.Could you please guide here how to Create Relationship between Department and Employee Table here????Appreciate you Kind attention...
@aapkanigam
@aapkanigam 7 жыл бұрын
+Sanjay Kumar part 26 will help you
@SanjayKumar-hc6iu
@SanjayKumar-hc6iu 7 жыл бұрын
Many Thanks...Let me Complete Upto Lab25..
@robelbeyene84
@robelbeyene84 7 жыл бұрын
Thanks for the wonderful tutorials. I got this error though: + $exception {"Object reference not set to an instance of an object."} System.NullReferenceException I'm using VS2017. How do I solve this issue?
@aapkanigam
@aapkanigam 7 жыл бұрын
+Robel Beyene this error comes when null value coming in your variable and you are using it some where . May be you are not getting data in your ViewBag. And you are using it on view page and doing iteration on it. Also make sure to check correct key and value pair .
@Mulllll
@Mulllll 7 жыл бұрын
hey ashish. Your tutorials are great and helps me a lot. even i do everything like you i get a error: "System.NullReferenceException. the object reference didnt define a object instance" something is wrong with the instancing of employee oder employeeVM. I am working with a local sql db but i think that is not the problem. Any Ideas? i am frustrating so much
@aapkanigam
@aapkanigam 6 жыл бұрын
Sorry for delay in response, You can get the code from the link given in description. If you find any difficulty the please free to ask ,, thanks
@krishnaparab9747
@krishnaparab9747 7 жыл бұрын
How to add update & delete Events in Calendar in MVC ?
@ramanjulureddy2458
@ramanjulureddy2458 4 жыл бұрын
Do you have any Git repository for this...
@ounly5094
@ounly5094 5 жыл бұрын
Hello sir! Can you help to create a video for search data using textbox?
@aapkanigam
@aapkanigam 5 жыл бұрын
Please watch part 37. Thanks
@srijanghosh4367
@srijanghosh4367 7 жыл бұрын
hello sir...my sql server database table could not show in my model.tt. what can i do ???
@aapkanigam
@aapkanigam 7 жыл бұрын
+Srijan Ghosh watch part 26 , you will get some idea
@suerbarsylmaz9792
@suerbarsylmaz9792 7 жыл бұрын
arkadaşlar bu linkten en güncel haliyle okullarda gösterilen veri tabanı uygulamasının
@aapkanigam
@aapkanigam 7 жыл бұрын
+Suer Barış Yılmaz can you please write this in English
@someone418
@someone418 7 жыл бұрын
nice tutorial. if we have to create many function then how will we call this function n where.
@aapkanigam
@aapkanigam 7 жыл бұрын
+Priyanka Gupta are you talking jquery or c# function
@ender2999
@ender2999 6 жыл бұрын
Jump scare at 3:35
@aapkanigam
@aapkanigam 6 жыл бұрын
Loz😅
@logingoogletesttest6690
@logingoogletesttest6690 6 жыл бұрын
how to login with google and fb in mvc and save data in db ?
@bobtaylor1577
@bobtaylor1577 5 жыл бұрын
i do not have any server names. Dude you are skipping alot of stuff
@aapkanigam
@aapkanigam 5 жыл бұрын
Nope
@sunnyjagtap1171
@sunnyjagtap1171 6 жыл бұрын
sir you dont have video on database connection without entity framework...Ado.net??
@aapkanigam
@aapkanigam 6 жыл бұрын
Nope..
@dulajudayanga4050
@dulajudayanga4050 7 жыл бұрын
@Model CREATE_MVC2 hello sir when I try to add like this in my view Index.cshtml , I can not see any intellisense plz tell me how do add my model clz to view index
@aapkanigam
@aapkanigam 7 жыл бұрын
+Dulaj Udayanga it should be @model not @Model
@dulajudayanga4050
@dulajudayanga4050 7 жыл бұрын
thank you so much great answer , I have watch so many videos in KZbin to learn MVC but not anyone to teach like you , thank you so much , Have a Great life Sir
@aapkanigam
@aapkanigam 7 жыл бұрын
+Dulaj Udayanga thanks.. keep learning and sharing
@lifet4800
@lifet4800 7 жыл бұрын
hii ashish,is code first approach or entity framework is better..?
@richievrutaal6152
@richievrutaal6152 5 жыл бұрын
Thank you, this example worked for me.
@jayendraadam4133
@jayendraadam4133 6 жыл бұрын
may i know sql datatype which is used here for Employee_Id
@aapkanigam
@aapkanigam 6 жыл бұрын
+Jayant Adam its an integer
@reyneermoisesmoralesleon6062
@reyneermoisesmoralesleon6062 5 жыл бұрын
i get this error: Object reference not set to an instance of an object.
@diogoteixeira9863
@diogoteixeira9863 5 жыл бұрын
How do I do if I want to output all the data from the database?
@aapkanigam
@aapkanigam 4 жыл бұрын
Db.TableName.ToList ()
@air32k
@air32k 7 жыл бұрын
Hi! Do you have a tutorial for creating this database and inserting data into it on SQL Server management tool? This should come helpful for continue this tutorial without getting help from other videos from YT except this tutorial.
@aapkanigam
@aapkanigam 7 жыл бұрын
+Spectral501 part 26 might help you ..
@air32k
@air32k 7 жыл бұрын
Thanks
@learnbydibya
@learnbydibya 5 жыл бұрын
Sir, can we use MVC with ADO.NET connection?
@sandoval3265
@sandoval3265 5 жыл бұрын
Yes, you also can use LINQ to SQL.
@meghamisra5622
@meghamisra5622 7 жыл бұрын
I want to create a report using join query. in SQL server I can use join query and get the report but I want the do same thing in MVC5 can you please tell me how to generate the report using join query in MVC and also tell me what is Migration in MVC I saw many posts saying that if you update table or database u need to use migration. If there is data in existing table I may loose them if I use Migration right.
@aapkanigam
@aapkanigam 7 жыл бұрын
+Megha Misra Use linq query to implement join in mvc
@meghamisra5622
@meghamisra5622 7 жыл бұрын
ok Thank you for your quick reply. Do you have any video of linq?
@aapkanigam
@aapkanigam 7 жыл бұрын
+Megha Misra No right now I don't have..you search on google on linq join queries
@meghamisra5622
@meghamisra5622 7 жыл бұрын
ok Thank you so much for your help
@aapkanigam
@aapkanigam 7 жыл бұрын
+Megha Misra Welcome..keep learning and sharing
@Part-II
@Part-II 5 жыл бұрын
Sonic BOOM at 3:35 :E
@assiadehmani5000
@assiadehmani5000 7 жыл бұрын
thanks for this video i have a problem in the(x=>x.EmployeeId == 1) in index page , can you help me ?
@aapkanigam
@aapkanigam 7 жыл бұрын
+Assia DEHMANI yes please.
@assiadehmani5000
@assiadehmani5000 7 жыл бұрын
error in this line Employee employee = db.Employees.SingleOrDefault(x => x.ID == 1); exactly in ID Any suggestions please ?
@aapkanigam
@aapkanigam 7 жыл бұрын
+Assia DEHMANI Its seems to be correct.. but what error are you getting. Try to use var employee = db.Employees.SingleOrDefault (x=>x.ID==1);
@yoskar18xd
@yoskar18xd 6 жыл бұрын
im having problems adapting SQL db to the project, i've missed the part where you explained that, pls help!
@aapkanigam
@aapkanigam 6 жыл бұрын
Please watch 26 for updating entity after any modification to table or db
@yoskar18xd
@yoskar18xd 6 жыл бұрын
@@aapkanigam well sorry, I just found out sql is not available, so I don't even have the DB install on visual studio, any alternative?...
@yoskar18xd
@yoskar18xd 6 жыл бұрын
In Mac I Meant!
@mohammadfasih7752
@mohammadfasih7752 7 жыл бұрын
what we should code if we want to display all the emplyees insted of one???
@aapkanigam
@aapkanigam 7 жыл бұрын
+Faizan Raza watch part 16
@mohammadfasih7752
@mohammadfasih7752 7 жыл бұрын
ok!!
@aliridhohabsyi1242
@aliridhohabsyi1242 7 жыл бұрын
Aisihis i got a problem with "employeeVM.EmployeeId = employee.EmployeeId;" because "An exception of type 'System.NullReferenceException' occurred in Technotips.dll but was not handled in user code." What should i do ??
@aapkanigam
@aapkanigam 7 жыл бұрын
+Ali Ridho Habsyi check for null value in model before assigning any property. Ex if (model!=null){// assign values }
@Mulllll
@Mulllll 7 жыл бұрын
got the same problem. the delet of "if (Model!=null)" gives the same error
@aapkanigam
@aapkanigam 7 жыл бұрын
+Michali Alex dont delete that .. are you sure you getting data from database? If you are inserting data and you id is primary key not nullable then dont assign any value to it.
@aapkanigam
@aapkanigam 7 жыл бұрын
+Michali Alex dont delete that .. are you sure you getting data from database? If you are inserting data and you id is primary key not nullable then dont assign any value to it.
@Mulllll
@Mulllll 7 жыл бұрын
hey ashish. thanks for answering so fast. i will subscribe and share your videos. i am not sure if i get data from database. in the first 4 videos i got data from database. but since i use the entity framework i get the nullreference exception. even if i check if model is not null. could it be that there is no conneciton to my database? but everything looks like in your video. damn since 4 hours i try to solve htis problem.
@shankarguru1309
@shankarguru1309 4 жыл бұрын
Awesome tutorial for beginners..!!
@aapkanigam
@aapkanigam 4 жыл бұрын
Thanks 😊 keep learning and sharing 🙏
@LuigiZuniga
@LuigiZuniga 7 жыл бұрын
Thanks for your Videos!!!
@aapkanigam
@aapkanigam 7 жыл бұрын
+Luis Alberto Pino Zuñiga keep learning and sharing
@crizalyncauilan8094
@crizalyncauilan8094 6 жыл бұрын
where is the database you use in video?
@aapkanigam
@aapkanigam 6 жыл бұрын
part 26 will help you
@DanGerouszaPoisonous
@DanGerouszaPoisonous 4 жыл бұрын
TY 2k times !!!
@tejaswininanaware
@tejaswininanaware 6 жыл бұрын
Is the TestController an empty controller?
@aapkanigam
@aapkanigam 6 жыл бұрын
There is only one method which will return a View
@saivigneshwaran150
@saivigneshwaran150 5 жыл бұрын
Thank You
@someone418
@someone418 7 жыл бұрын
thanks for reply. C# Function.
@aapkanigam
@aapkanigam 7 жыл бұрын
+Priyanka Gupta Yes you can create many method which is returning something. Like string , int , list, class etc .. suppose you want to create add funtion then use public int Sum (int i,int j){ Int c= i+j; return c; } Call this function in any other class .. Example - int result= Sum (5,7);
@paragkotekar1763
@paragkotekar1763 6 жыл бұрын
Nice and Detailed
@markusmulholland
@markusmulholland 5 жыл бұрын
Very easy to follow and understand. Thank you sir
@ayoforyou448
@ayoforyou448 4 жыл бұрын
many thak's mate
@bijoy_7168
@bijoy_7168 6 жыл бұрын
It is helped me a lot
@aapkanigam
@aapkanigam 6 жыл бұрын
Keep learning and sharing thanks
@navzme
@navzme 6 жыл бұрын
Thanks for awesome video
@aapkanigam
@aapkanigam 6 жыл бұрын
Thanks ..keep learning and sharing
@csabasomogyi6780
@csabasomogyi6780 7 жыл бұрын
How can i create database?
@aapkanigam
@aapkanigam 7 жыл бұрын
+Csaba Somogyi watch part 26
@csabasomogyi6780
@csabasomogyi6780 7 жыл бұрын
I dowloaded the sql server managment studio but i can't know how can i connect to database.
@aapkanigam
@aapkanigam 7 жыл бұрын
+Csaba Somogyi watch part 6
@bobtaylor1577
@bobtaylor1577 5 жыл бұрын
I jumped from tutorial 4 to tutorial 6 because of your sql !!!!!!!
@Anilkumar-pi6gf
@Anilkumar-pi6gf 7 жыл бұрын
Thanks! Your videos are very helpful. It would be great if you provide code for this series.
@nguyenhongduong8688
@nguyenhongduong8688 6 жыл бұрын
Thank you so much, This video is very important with me
@visaboxofficial
@visaboxofficial 6 жыл бұрын
Excatly, This is what i wanted.... An other Guy on KZbin has Also such Wonderful Videos To go On with MVC, but he missed this step, which took my 4 days, and forced me to switch to some other tutorials, which ultimately are your's Now. Stay Blessed !
@aapkanigam
@aapkanigam 6 жыл бұрын
+Art Is LIFE is Art Thanks keep learning and sharing
@n.hartmann5534
@n.hartmann5534 5 жыл бұрын
Im guessing the other guy is KudVenkat:)
@jenasusil6
@jenasusil6 7 жыл бұрын
Hello sir 1st of all Thank you very much for your beautiful videos..Sir can you please help me to solve this below error. Even after i have changed my control name in route config file i am getting the same error. Server Error in '/' Application. The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly. Requested URL: / Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.36290
@aapkanigam
@aapkanigam 7 жыл бұрын
+Susil Jena please check the controller and method name ..and then route. config file . This error comes when either the requested file is missing or incorrect method or controller name being mentioned.
@jenasusil6
@jenasusil6 7 жыл бұрын
Technotips - Ashish sir i have updated my controller name and action method name in routeconfig.cs file.but still i am getting same error.
@aapkanigam
@aapkanigam 7 жыл бұрын
+Susil Jena There might be problem with your route config file . If you are using attribute routing the Part 38 may be helpful for you to set correct route value .
@daviddonadze221
@daviddonadze221 6 жыл бұрын
Thank u so much for this detailed Video. u are the best!!!!!!
@aapkanigam
@aapkanigam 6 жыл бұрын
+David Donadze Thanks ..keep learning and sharing
@Infinitesap
@Infinitesap 6 жыл бұрын
Awsome quality of teaching! Thanks very much :)
@aapkanigam
@aapkanigam 6 жыл бұрын
Thanks ..keep learning and sharing
@hamedkadkhodaie7715
@hamedkadkhodaie7715 7 жыл бұрын
No ! No ! No ! why are you calling the Database in controller ? You are ruining your MVC Pattern, it's DB
@aapkanigam
@aapkanigam 7 жыл бұрын
+Hamed kadkhodaie Hey dear .. I have not explained repository pattern yet .. there will call database from data access layer-> business -> controller -> view
@aapkanigam
@aapkanigam 7 жыл бұрын
+Hamed kadkhodaie MVC does not have to do with the architecture you have provided . If I dont use model ,still I can render data to view. YOU can call database directly from controller without having any issue.
@Anilkumar-pi6gf
@Anilkumar-pi6gf 7 жыл бұрын
Hamed kadkhodaie Yes you can call the database from controller. At Microsoft official site you will get several example of controller calling database .
Part 7- Working With Multiple Tables in ASP.NET MVC (Model-View-Controller)
12:49
MVC: Model View Controller with Database (SQL Server) P1
29:22
AVKDigital
Рет қаралды 12 М.
Spongebob ate Michael Jackson 😱 #meme #spongebob #gmod
00:14
Mr. LoLo
Рет қаралды 10 МЛН
哈哈大家为了进去也是想尽办法!#火影忍者 #佐助 #家庭
00:33
إخفاء الطعام سرًا تحت الطاولة للتناول لاحقًا 😏🍽️
00:28
حرف إبداعية للمنزل في 5 دقائق
Рет қаралды 38 МЛН
CRUD without Entity Framework in ASP.NET Core MVC
44:30
CodAffection
Рет қаралды 105 М.
Inside a Google data center
5:28
Google Workspace
Рет қаралды 21 МЛН
Entity framework core migrations
8:05
kudvenkat
Рет қаралды 224 М.
Database Lesson #1 of 8 - Introduction to Databases
38:43
Dr. Daniel Soper
Рет қаралды 1,2 МЛН
connect database asp.net mvc | database first approach in entity framework mvc
7:06
Spongebob ate Michael Jackson 😱 #meme #spongebob #gmod
00:14
Mr. LoLo
Рет қаралды 10 МЛН