{"id":28,"date":"2007-02-20T02:15:53","date_gmt":"2007-02-20T10:15:53","guid":{"rendered":"http:\/\/blog.danielparnell.com\/?p=28"},"modified":"2007-02-20T02:15:53","modified_gmt":"2007-02-20T10:15:53","slug":"aspnet-blows-chunks","status":"publish","type":"post","link":"https:\/\/blog.danielparnell.com\/?p=28","title":{"rendered":"ASP.Net blows chunks"},"content":{"rendered":"<p><span style=\"font-size: 12pt; font-family: Helvetica; \">Really big nasty chunks!  I guess I&#8217;ve been spoilt by working with rails, and to be fair it&#8217;s not really ASP.Net I don&#8217;t like, it&#8217;s ADO.Net.  I mean really, who wants to write 12 lines of code to fill a grid with data from a database!&nbsp;<br \/>&nbsp;<br \/>1. construct a new SqlConnection object&nbsp;<br \/>2. construct a new SqlCommand object&nbsp;<br \/>3. construct a new SqlParameter object&nbsp;<br \/>4. set the parameter name&nbsp;<br \/>5. set the parameter value&nbsp;<br \/>6. add the parameter to the select command&nbsp;<br \/>7. construct a new DataSource object&nbsp;<br \/>8. construct a new SqlDataAdapter object&nbsp;<br \/>9. fill the DataSource using the SqlDataAdapter&nbsp;<br \/>10. connect the DataSource property of the grid to the DataSource object constructed earlier&nbsp;<br \/>11. call the DataBind method of the grid to actually load the data&nbsp;<br \/>12. close the database connection&nbsp;<br \/>&nbsp;<br \/>I guess it&#8217;s all supposed to be used via the GUI editing tools which should build a lot of that stuff for me automatically.  I assume the GUI built data binding can handle parameters for the select.&nbsp;<br \/>&nbsp;<br \/>Another feature of Rails that I&#8217;m missing in ASP.Net is partials.  I&#8217;m using master pages to give me some of the things that I would have used a layout for in Rails, but there doesn&#8217;t seem to be anything quite like partials in ASP.Net \ud83d\ude41  Fortunately for me it&#8217;s a simple application I have to build so there are only a couple of repeated sections of code.&nbsp;<br \/>&nbsp;<br \/>Also, what&#8217;s up with not allowing the TextBox control to be bound to a DataSource?  I&#8217;ve got better things to do with my time than to write a line of code for each TextBox on my form to fill it with data and another to then put that data back into a DataTable so I can have it saved to a database.&nbsp;<br \/>&nbsp;<br \/>A word of advice to all ASP.Net developers who read this,  don&#8217;t use Ruby on Rails.  It will only make you realize how bad you&#8217;ve got it \ud83d\ude09<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Really big nasty chunks! I guess I&#8217;ve been spoilt by working with rails, and to be fair it&#8217;s not really ASP.Net I don&#8217;t like, it&#8217;s ADO.Net. I mean really, who wants to write 12 lines of code to fill a grid with data from a database!&nbsp;&nbsp;1. construct a new SqlConnection object&nbsp;2. construct a new SqlCommand &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.danielparnell.com\/?p=28\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;ASP.Net blows chunks&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[2,8,6,5],"tags":[],"class_list":["post-28","post","type-post","status-publish","format-standard","hentry","category-programming","category-rails","category-web","category-windows","entry"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p561S3-s","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/blog.danielparnell.com\/index.php?rest_route=\/wp\/v2\/posts\/28","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.danielparnell.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.danielparnell.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.danielparnell.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.danielparnell.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=28"}],"version-history":[{"count":0,"href":"https:\/\/blog.danielparnell.com\/index.php?rest_route=\/wp\/v2\/posts\/28\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.danielparnell.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=28"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.danielparnell.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=28"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.danielparnell.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=28"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}