Dynamic Width of ComboBox (Small Tweak)

9 10 2009

Recently I have gone through a situation where there will be a ComboBox and it will have a list of data, some items will be too lengthy. And I have to show the width of Combo with the maximum size of the item in the dropdown list of Combo. First I thought I must iterate through through all the list items and get all the lenths and find the maximum length of the item. And then set that length to the comob. I search for samples with any simpler solution than the above, but all the people suggest the above process only.

Instead of doing the above process just remove the width property to the combo, instead provide minWidth (so that combo will show minimum width even there is no data). This solves my problem.





Update and Select statements in one Stored Procedure

25 09 2008

When there are multiple update statements or delete statements in a stored procedure with a select statement at the end. If we execute this type of procedure, being a select statement at the end we expect a result set. Instead it will throw an SQLException : The statement did not return a result set.

This is because the update statements in the proecedure and it will return the number of rows updated, so it throws that exception.

Solution : In your procedure use SET NOCOUNT ON, it will remove the messages when rows were updated and you will get result set.








Follow

Get every new post delivered to your Inbox.