I want some Moore

Blog about stuff and things and stuff. Mostly about SQL server and .Net
posts - 226, comments - 2295, trackbacks - 33

My Links



Hi! My name is 
Mladen Prajdić  I'm from Slovenia and I'm currently working as a .Net (C#) and SQL Server developer.

I also speak at local user group meetings and conferences like SQLBits and NT Conference
Welcome to my blog.
SQL Server MVP

My Books

SQL Server MVP Deep Dives 2
The Red Gate Guide to SQL Server Team based Development Free e-book

My Blog Feed via Email
Follow MladenPrajdic on Twitter

Users Online: who's online

Article Categories


Post Categories

Cool software

Other Blogs

Other stuff

SQL stuff

VS 2k5 autogenerated code gem

A coworker found this in code generated by Visual Studio 2005:

this.sqlSelectCommand2.CommandText = "SELECT columnName1, columnName2, columnName3, columnN" + 
"ame4, columnName5, columnName6 FROM MyViewFromMa" +

Searching for MyViewFromManyTables is beautifull...

Refactor that!!

Print | posted on Monday, November 27, 2006 11:34 AM | Filed Under [ .Net Misc ]



# re: VS 2k5 autogenerated code gem

Another good reason to use the Command object and execute a stored procedure :).
11/27/2006 4:58 PM | Jon

# re: VS 2k5 autogenerated code gem

Autogenerated code isn't there for refactoring beacuse - it is autogenerated. If you want to have a strong typed database access then you need another approach.
Jon: both approaches do use command object and both can use a stored procedure.

I agree though that VS designers aren't suitable for larger applications (I tend to avoid them except when I have to create a quick sample).
11/28/2006 10:12 AM | Miha Markic

# re: VS 2k5 autogenerated code gem

well if i change the views name in sql server i can use SQL refactor to rename/refactor the whole db it and it's great. and when i want to change it in code it's really fun to find :))

but i agree with you Miha.
11/28/2006 10:28 AM | Mladen

# re: VS 2k5 autogenerated code gem

Miha my point was your procedure name will not be (hopefully) the length of that SQL string. You avoid all the SELECT blah1, blah2 FROM...+... etc.
11/28/2006 1:30 PM | Jon

# re: VS 2k5 autogenerated code gem

Mladen: Yes, IMO those designers are not meant to work on larger projects.

Jon: I see. :-)
11/28/2006 4:10 PM | Miha Markic
Comments have been closed on this topic.

Powered by:
Powered By Subtext Powered By ASP.NET