Wednesday, March 5, 2014

Text input validation

Text input validation with jquery
 <script type="text/javascript">
  $(function () {
            $('input[type=text]').on('keyup', function (e) {
                if (/[^.a-z_ 0-9- A-Z]/.test(this.value)) {
                    this.value = this.value.replace(/[^.a-z_ 0-9- A-Z]/g, '');
                }
            });
        });   
</script>

this will allow only A to Z ,a to z , 0-9 and some character ,-_. also

Friday, January 17, 2014

Truncate All the table of Database and delete all the data of all the table from database


For truncate

USE MyDatabase
EXEC sp_MSforeachtable 'TRUNCATE TABLE ?'

For Delete


USE MyDatabase
EXEC sp_MSforeachtable 'DELETE FROM ?'