In ASP.NET we can use IsNullOrEmpty method to check whether the string is null or contains an empty string.
string str="test";
if (string.IsNullOrEmpty(str))
{
// Code goes here
}
In Sql server we can use the below code.
Declare @Address='sri lanka'
IF @Address IS NOT NULL AND LEN(@Address)>0
BEGIN
// Code goes here
END
Tuesday, December 11, 2012
Check string Null or Empty in ASP.NET and Sql Server
Subscribe to:
Post Comments (Atom)
No comments:
Write comments