Tag Cloud


Powered by Easytagcloud v2.1


Regular expression to filter special characters in C# PDF Print E-mail
Written by Arpit Sharma   
Thursday, 19 April 2012 12:37

The below code is used to check if the string input in the function/Method is not containing any special characters like ??$# etc .

The below function uses regular expression to fulfil its purpose so add

 

 

using System.Text.RegularExpressions; namespace in your code




public bool vldRegex(string strInput)
    {
        Regex myRegex = new Regex("^[A-Za-z0-9 _,.)?'"!(&/:`;-]*[A-Za-z0-9][A-Za-z0-9 _,)?'"!(&/.:`;-]*$");
        bool isValid = false;
        if (string.IsNullOrEmpty(strInput))
        {
            isValid = false;
        }
        else
        {
            isValid = myRegex.IsMatch(strInput);
        }
        return isValid;
    }

The value returned is false if the text(string) contains special characters  and true if no special characters are found

 

 
New Word Count tool on TechUncle.com PDF Print E-mail
Written by Arpit Sharma   
Sunday, 13 November 2011 16:39

Bookmark and Share

TechUncle.com has always tried to make your life easier by bringing free and intuitive tools , we are proud to bring to you another tool in this class :

The tool can be found at the below link  :

->  http://techuncle.com/TuSoftwares/WordCountToolv1.php

Check out the tool and let us know your feedback.

The features of the tool are  :

 

  1. ->Counts the number of words
  2. ->Counts the number of letters

 

We will keep on upgrading this tool and bring better quality with each version.

 

Thanks and Regards,
TechUncle Team

Last Updated on Sunday, 13 November 2011 23:07
 
How to use Nullable types in c# PDF Print E-mail
Written by Arpit Sharma   
Saturday, 02 July 2011 17:50

The below example shows how to use  nullable types (note it does not apply to string type)

int? a = null;
int? b = null;
int c = a ?? b ?? -1;

 

In the above example we declare two nullable type variables and set them to null and in the last expression if 'a' is null then 'b' is selected and if 'b' is null then '-1' is selected.

'??' is used if you want to use some default value if the variable on left is null (then the right side value is used in that place)

Last Updated on Saturday, 21 April 2012 21:02
 
How to send mail from database in sql server 2005 using sp_send_dbmail PDF Print E-mail
Written by Arpit Sharma   
Friday, 01 July 2011 16:01

The below procedure located in msdb database which is one of the default database can be used to send mails weather from a trigger or a procedure , remember to replace the email ID's in  @recipients='to_email', @copy_recipients='test_email',@blind_copy_recipients ='test_email' with the required email id's as per need

You will need to create a profile , this can be done by going on Management(located just below your database instance tree view) ->Database Mail(right click on it) and just create a new profile and enter the profile name in the procedure below:

 


EXEC msdb.dbo.sp_send_dbmail 
 @recipients='to_email@test.com',
@body='mail_body',
 @body_format ='HTML', -- this is used if you want to send body which contains HTML tags 
 @copy_recipients='cc_email@test.com', -- to whom you want to copy
@blind_copy_recipients ='bcc_email@test.com', -- BCC optional
 @subject='subject', -- subject of email goes here
 @profile_name='profile_name'; -- the profile name goes here

Last Updated on Saturday, 21 April 2012 21:03
 
How to create a table from an existing table PDF Print E-mail
Written by Arpit Sharma   
Tuesday, 28 June 2011 17:32

To create a table from an existing table the the query goes like this :

use AdventureWorks -- this is the database name
 
select top 0 * into dbo.address from person.address

 

 

And if you want all the rows also with columns  then it should be :

select  * into dbo.address from person.address

Last Updated on Saturday, 21 April 2012 21:03
 
<< Start < Prev 1 2 3 Next > End >>

Page 1 of 3
Tech Uncle, Copyright 2011 - 13 Techuncle.com . All rights reserved.
Subscribe to our RSS feeds
Find us on YouTube
Follow Us On Twitter