Tuesday, April 5, 2011

SQL Update Query With inner Join and case

tblEMp

EmpID

Name

Salary

DepID

1

Sachin

1000

1

2

Mahora

2000

2

3

Afridi

3000

1

tblDep

DepID

DepName

1

D1

2

D2
Now

Now Question is Update Salary with 10% where DepName is D1.and 20% where DepName is D2. Use Join and Single Query Only.
Ans:-  update tblemp set Salary = Case tbldep.lname
           when 'D1' then Salary +(Salary*0.10)
          when 'D2' then Salary +(Salary*0.20)
          end
           from tblemp join tbldep on tblemp.depid=tbldep.depid

Wednesday, March 16, 2011

JavaScript return Value to Label or TextBox

Here Example of Email Validation is given

function Email(obj1)
{
var email=obj1.value;
//alert(email);
var reguex=/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
if(reguex.test(email))
{
return true;
}
else
{      

document.getElementById("lblemail").innerHTML="email not valid";

return false;
}
}



Friday, March 4, 2011

What is ADO.Net ?

ADO.NET is an object-oriented set of libraries that allows you to interact with data sources. Commonly, the data source is a database, but it could also be a text file, an Excel spreadsheet, or an XML file.