ASP.Net blows chunks

Really big nasty chunks! I guess I’ve been spoilt by working with rails, and to be fair it’s not really ASP.Net I don’t like, it’s ADO.Net. I mean really, who wants to write 12 lines of code to fill a grid with data from a database! 
1. construct a new SqlConnection object 
2. construct a new SqlCommand object 
3. construct a new SqlParameter object 
4. set the parameter name 
5. set the parameter value 
6. add the parameter to the select command 
7. construct a new DataSource object 
8. construct a new SqlDataAdapter object 
9. fill the DataSource using the SqlDataAdapter 
10. connect the DataSource property of the grid to the DataSource object constructed earlier 
11. call the DataBind method of the grid to actually load the data 
12. close the database connection 
I guess it’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. 
Another feature of Rails that I’m missing in ASP.Net is partials. I’m using master pages to give me some of the things that I would have used a layout for in Rails, but there doesn’t seem to be anything quite like partials in ASP.Net πŸ™ Fortunately for me it’s a simple application I have to build so there are only a couple of repeated sections of code. 
Also, what’s up with not allowing the TextBox control to be bound to a DataSource? I’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. 
A word of advice to all ASP.Net developers who read this, don’t use Ruby on Rails. It will only make you realize how bad you’ve got it πŸ˜‰

Join the Conversation


  1. For, since the data grids are usually display only, you can skip step 7-9 and assign the reader right to the data source. I agree though, Ruby On Rails makes things so much easier.

  2. What you are comparing is apples to some sour grapes.
    Dude, I have never written one piece of code more than once in .NET.
    You need to give it as much time as you obviously have given ruby on crack.

  3. πŸ™‚ After using Rails why would I want to go back to something that is clearly inferior πŸ˜‰
    But seriously, I can remember looking at ASP.Net when it first came out and thinking, why would anyone write web apps any other way. Then I used it for a while and discovered by ;). I’ve been building web apps for a very long time and Rails is an amazing step up in productivity from everything I’ve used before. The company I’m working for at the moment was building a very complex web application in ASP.Net using C#, and I have to admit I was kind of looking forward to getting back into ASP.Net after a long stint of PL/SQL (almost anything is better than that). I’d been playing around with Rails for a few months at that stage and I showed it to the other guys in the team. The next thing I know we were doing a test in Rails to see what we could do. In a week we’d implemented more of the system in Rails than had previously been built with C# and ASP.Net over several months. This was with the other people on the team learning Rails on the way. I think that was what sold management on ditching ASP.Net, and we haven’t looked back.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.