//Js Code
function numberValidation(txtbx,event)
{
var txtbx1=document.getElementById(txtbx);
if((event.keyCode >= 48 && event.keyCode <= 57)||(event.keyCode >= 96 && event.keyCode <= 105)||(event.keyCode == 8 ) ||(event.keyCode == 9) || (event.keyCode == 12) || (event.keyCode == 27) || (event.keyCode == 37) || (event.keyCode == 39) || (event.keyCode == 46) )
{
return true;
}
else
{
alert("Only Numeric Value");
txtbx1.value="";
return false;
}
}
//.cs file (PageLoad)
textbox1.Attributes.Add("onKeyDown", "return numberValidation('" + textbox1.ClientID + "',event);");
Saturday, March 13, 2010
Primary and Foreign Key
//Priamry Table
create table tbluser(
UserId varchar(50) constraint [UID] primary key not null,
UserName varchar(100) not null)
//Foreign Key Table
create table tblUserPermission(
UserID varchar(50) constraint fkUId foreign key (UserId) references tbluser(UserId) not null)
create table tbluser(
UserId varchar(50) constraint [UID] primary key not null,
UserName varchar(100) not null)
//Foreign Key Table
create table tblUserPermission(
UserID varchar(50) constraint fkUId foreign key (UserId) references tbluser(UserId) not null)
Email Send
using System.Net.Mail;
private void btnSend_Click(object sender, EventArgs e)
{
MailAddress mailTo = new MailAddress(txtAddress.Text);
MailAddress mailFrom = new MailAddress(txtFrom.Text);
MailMessage message = new MailMessage(mailFrom, mailTo);
message.Subject = txtSubject.Text;
message.Body = txtMessage.Text;
message.Priority = MailPriority.High;
SmtpClient c = new SmtpClient("ServerName");
c.Send(message);
}
}
private void btnSend_Click(object sender, EventArgs e)
{
MailAddress mailTo = new MailAddress(txtAddress.Text);
MailAddress mailFrom = new MailAddress(txtFrom.Text);
MailMessage message = new MailMessage(mailFrom, mailTo);
message.Subject = txtSubject.Text;
message.Body = txtMessage.Text;
message.Priority = MailPriority.High;
SmtpClient c = new SmtpClient("ServerName");
c.Send(message);
}
}
Duplicate Value Findout(Sql server)
Select count(*) ,firstname,lastname,depart from emp group by firstname,lastname,depart having count(*)>1
Top 3 Salary
//You can find out top 3 salry.........like
Select Top 1 salary from Emp where salary in(Select Top 3 salary from emp order by salary desc)
Select Top 1 salary from Emp where salary in(Select Top 3 salary from emp order by salary desc)
Subscribe to:
Posts (Atom)