Length of image columns - DATALENGTH function

by dotnetpete 25. June 2009 16:42

I needed to find the length of an image column in the database. You can use the LEN function on varbinary columns but not image columns.

The DATALENGTH function however does work very nicely. 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

SQL

More WinForms madness

by dotnetpete 24. June 2009 21:10

We recently upgraded a .NET 1.1 app to .NET 3.5 and had some issues with anchoring of controls and in one case on a client machine they got an OutOfMemoryException. 

It turned out that the conversion had set the font for this form to be MS San Serif with controls on the form Tahoma. Changed the form's font to Tahoma and anchoring going again and no reports of errors from the client. Yet. 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

WinForms tab control madness

by dotnetpete 24. June 2009 20:48

When you drop a WinForms tab control on a form, 2 tabs are auto created for you. Nice! However new tabs are not created equal. Any new tabs that are created are not padded where as the defaults tabs as padded 3 pixels left, top, right and bottom. 

 Madness! 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Visual Studio comment/uncomment shortcut keys in config files

by dotnetpete 28. May 2009 15:49

Visual studio's shortcut keys for commenting (Ctrl-K, C) and uncommenting (Ctrl-K, U) and very handy for blocks of code or even singles lines if your cursor is not at the start of the line.

Something interesting though is that these shortcuts also work within the config files putting <-- and --> at the start and end of the line(s) as required (or removing them if you're uncommenting).

Very handy if your development config files contain multiple connection strings etc. 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Visual Studio

Undocumented sp_MSforeachtable stored procedure

by dotnetpete 29. April 2009 12:31

Found a very cool undocumented stored procedure in SQL today.

For example if I want to rebuild all indexes for all tables I could do

sp_MSforeachtable @command1="print '?' DBCC DBREINDEX ('?')"

Very handy! 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

SQL2008

Missing indexes notification in SQL 2008

by dotnetpete 23. April 2009 10:55

Came across a very handy feature of the actual and estimated query plans today. When I ran the query I was tuning at the top of the query plan window underneath the query, the following text appeared:

Missing Index Details from Queries 2.sql

The Query Processor estimates that implementing the following index could improve the query cost by 88.9016%.

If I right clicked I got the option to choose the "Missing Index Details..." option which opened a new query window with the index create statement ready to run (I just had to supply the index name).

It was smart enough to suggest index columns and included columns for the index as well. 

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

SQL2008

Replication in SQL2008 of XML data type columns

by dotnetpete 27. March 2009 15:35

Seems that XML data type columns are not replicated (via merge replication anyway) between sites. Bummer! 

My table with the XML data type column had data at one site, not at the other and vice versa. 

Luckily I'm not doing anything XMLy on the data (I didn't create the column but I wouldn't have forseen any concequences like this either), so I was able to create a new varchar(max) column and populate at each site. The data is the replicated to each site ok.

Would nice to have a pre-replication utility to rip through a database and warn for these types of situtations. In a previous post I ran into a similar issue with transactional replication and update of text columns at a subscriber. 

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

SQL2008

Visual WebGUI

by dotnetpete 27. March 2009 11:29

I'm doing some consulting as a company who are trying to speed up delivery of CRUD web forms and are looking at a product called Visual WebGUI.

http://www.visualwebgui.com/

Looks pretty interesting. At design time you seem to be working with WinForms forms and controls and then at runtime it translates this into HTML. 

At runtime it generates the equivalent HTML and does a lot of stuff client side. I had a button and a textbox on my form. On click of the button I set the text of the textbox to "Clicked!" and there was no postback. 

Anyone with experience with Visual WebGUI, I'd love to hear what you liked and what you didn't. If you had the time over would you still have used it? 

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

References node in VB.NET projects

by dotnetpete 24. March 2009 16:17

Why on earth isn't the references node visible by default in VB.NET projects. You have to kick and scream to get the solution node displayed, ok melodramatic, Tools -> Options -> Projects And Solutions -> and then check "Always show solution", but there doesn't seem to be the same level of respect for the references node. 

You can see it if you show all files (project by project mind you), but then you see the bin and obj directories as well.

I found a feedback post here, which was attached to VS2005 and to quote:

"One of our goals for VB 2005 was to reduce the clutter in the IDE and let you focus on the code you are writing." 

Ah now this is a totally different situation now. If you're trying to reduce clutter and focus on the code you're writing, why don't you hide the My Project, App_*, Web References, Service References and any project folders you have as well.

And while you're at it, speed up VS and make it crash less so we can actually get on to focus on actual code instead of loads of wait time and having the VS splash screen burned into my monitor.

Although I am very grateful that I am using MS IDEs. I was working on a project last year that had a Java middle tier and on more than one occasion the middle tier guys had to debug their IDE! 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Visual Studio

To 3.5 SP1 Client or not to 3.5 SP1 Client

by dotnetpete 19. March 2009 10:53

The Visual Studion 2008 setup project launch conditions contains two entries for .NET 3.5 - 3.5 SP1 Client and 3.5.70329. So which one is actually 3.5 SP1?

According to wiki 3.5 SP1 is actually 3.5.70329.1 and straight 3.5 is 3.5.21022.8.

So what's 3.5 SP1 Client?

Interestingly you get a build warning if either of these options is installed and Windows 3.1 is not a pre-requisite. 

As a side issue I could not tick 3.5 SP1 as a pre-requisite and also use the "Download pre-requisites from the same loction as my application" option. I would get the following error at build time 

The install location for prerequisites has not been set to component vendor's web site and the file 'DotNetFX35SP1\dotNetFX20\netfx20a_x86.msi' in item '.NET Framework 3.5 SP1 can not be located on disk.

You can find instructions here in section 2.3.1.1.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Visual Studio

Powered by BlogEngine.NET 1.4.5.0
Theme by Mads Kristensen