Friday, February 18, 2011

Validator Controld in ASP.NET

ASP.NET provides an easy to use  set of validation controls to check for errors in user input and display messages to the user.

RequiredFieldValidator - Checks validated control contains value.

CompareValidator - Checks user input against constant value, value of another control or for a specified data type.

RangeValidator - Checks if user input is between specified lower and upper boundaries.

RegularExpressionValidator - Checks if user input matches a patter defined by a regular expression.

CustomValidator - Checks user input against validation logic that developer writes.


Saturday, January 15, 2011

What is the difference between Bind and Eval in ASP.NET?


Eval is one way (read only) databinding

Bind allows two way (read/write) databinding.

Monday, December 20, 2010

Formatting float to varchar in non scientific notation

When trying to convert a float value to varchar "Convert" returns string that represents the float value in sceientific notation.

e.g.

DECLARE @Float as float =1900000.0

SELECT CONVERT (varchar(50),@Float)

Results
---------
1.9e+006

However if you would like a string "1900000.0" you can use one of the methods below

DECLARE @Float as float =1900000.0

SELECT CONVERT(varchar(100), CAST(@Float AS decimal(38,1)))
SELECT ltrim(STR(@Float, 50, 1))

Both of them return a string
--------------------------
1900000.0

Wednesday, November 24, 2010

Find dependencies on a table(MS SQL)

The following script lists all the procedures that reference a given table name, along with referenced columns. (Does not work on dynamic queries)

DECLARE @TableName varchar(100)
SET @TableName = 'MyTable'

SELECT
SourceSchema = OBJECT_SCHEMA_NAME(sed.referencing_id)
,SourceObject = OBJECT_NAME(sed.referencing_id)
,ReferencedDB = ISNULL(sre.referenced_database_name, DB_NAME())
,ReferencedSchema = ISNULL(sre.referenced_schema_name,
OBJECT_SCHEMA_NAME(sed.referencing_id))
,ReferencedObject = sre.referenced_entity_name
,ReferencedColumnID = sre.referenced_minor_id
,ReferencedColumn = sre.referenced_minor_name
FROM sys.sql_expression_dependencies sed
CROSS APPLY sys.dm_sql_referenced_entities(OBJECT_SCHEMA_NAME(sed.referencing_id)
+ '.' + OBJECT_NAME(sed.referencing_id), 'OBJECT') sre
WHERE sed.referenced_entity_name = @TableName
AND sre.referenced_entity_name = @TableName

Sunday, October 10, 2010

Google Apps Standard Edition

Link to set up domain for Google Apps Standard Edition is as below http://www.google.com/a/cpanel/domain/new

Friday, September 24, 2010

MyMobiler-nice tool to remote control a mobile device

Nice tool to have when developing mobile applications. It works as remote desktop for your mobile device making testing on actual device easier.


MyMobiler v1.25 (02/07/2008) - FREEWARE

* View your mobile screen on your desktop.
* Control your mobile by using desktop keyboard and mouse.
* Copy/Cut/Paste text between mobile and desktop.
* Capture mobile screen.
* Drag and drop files to your mobile.
* Support ActiveSync / IP Connection
* Support Mobile Explorer (File Browse)
* Run Command by Ctrl-Enter

This freeware can be downloaded at http://www.mymobiler.com/

Works great with Symbol handheld scanners with Windows Mobil 5

Saturday, August 21, 2010

Find out free disk space on SQL server

The xp_fixeddrives returns a list of physical hard drives associated with the SQL Server machine and the number of megabytes of free space on each one.

exec xp_fixeddrives