data binding - Using ASP.NET MVC without an ORM -


In my ASP MVC application, I am using my SQL (rather than the link from SQL or other ORM) so that my database can be checked.

I want to pass the results of the database for my thoughts and to recapture the results in my thoughts. But I'm not sure how to do this. I have seen every example passes some strings or uses L2S I want to give something like nested hashtables, but only one thing I can think of is to pass a SqlDataReader object, but it is actually a Looks like bad idea.

How do I view the results of my database from a standard SQL query? I would really like to use Linq or other ORM, but we direct the requirements (do not ask me why I do not understand). I'm doing this in VB, I'll try best to convert to any C # example.

You can create simple squares for data. You can manually create objects in your controller with a data reader You want to move and then populate a list, and then pass it in your view - eg. (C # but it should be easy to convert)

  // Open your connection / liability etc. List & lt; Customers & gt; Customers = new list & lt; Customers & gt; (); While (dataReader.Read ()) {customer C = new customer (); C. IID = Data Reader GetInt 32 (0); C.Name = dataReader.GetString (1); // etc. (you want to use string indexers instead of ints for methods received) customers.Add (c); } // Close and see settlement of your dealer / connection etc. as a return ("list", customer) as always;  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -