Entity framework & Model class

21 September, 2018

Related Blogs

Example to display the data in mvc with out using entity frame work(With out using model class)

Create a new mvc2 application 2Add a new view page in home folder(sample)2Go to home controller.cs2Include the following the namespace


Using; Using;


2create the an action with name


2write the following code   Public Action Result Sample () { Sql connection  con = new sql connection (“”); String s= “select * from emp details “; Sql data adapter da = new sql data adapter (s, con); Data set ds = new data set (); Da. Fill (ds, ‘x’); List <data row> r = new list <data row> (); For each (data row . x in ds. Tables [0].rows) R.add (); View data [“R”] = R; Return view (); }   2Go to sample view 2Write the following code <% @ Import  name space = ‘’ % > <body> <h2>Satya technologies  </h2> <div> <% HTML Begin Form ();%> <table border = ‘2’ align = ‘center’ > <tr> <th>EMP id </th> <th> E NAME </th><th>E sal </th> </tr> <% for each (var x in (1 enumerable  <Data row> view data [‘R’])  I %)> <tr> <td><% : HTML. Encode (x [0]%)></td> <td><% : HTML. Encode (x [1]%)></td> <td><% : HTML. Encode (x [2]%)></td> </tr> <% } %> </table> <% HTML. End form (); %> </div> </body>  
About Author


Author Bio

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills .