Adding a Primary Key Constraint
on Column
ALTER TABLE employee ADD
CONSTRAINT emp_id_pk PRIMARY KEY(emp_id)
Increasing the width of a column
ALTER TABLE employee ALTER
COLUMN emp_name varchar(100)
Decreasing the width of a column
ALTER TABLE employee ALTER
COLUMN emp_name varchar(50)
Changing the Data Type of Column
ALTER TABLE employee ALTER
COLUMN emp_name nvarchar(50)
Add a NULL Constraint on Column
ALTER TABLE employee ALTER
COLUMN emp_name nvarchar(50) NULL
Add a NOT NULL Constraint on
Column
ALTER TABLE employee ALTER
COLUMN emp_name nvarchar(50) NOT NULL
Add a new Column on Table
without any Constraint
ALTER TABLE employee ADD
emp_age varchar(10)
Add a new Column on Table with a
Constraint
ALTER TABLE employee ADD
emp_code varchar(100) CONSTRAINT emp_code_uq UNIQUE
Drop a Column from Table
ALTER TABLE employee DROP
COLUMN emp_code
Adding a Check Constraint Column
ALTER TABLE employee ADD CONSTRAINT
emp_age_ck (emp_age > 18)
Here is the our aspx page that contains a JavaScript
method and a hidden filed and button.
<script
type="text/javascript">
function SetValue() {
var sValue = "Hello
World";
document.getElementById("Hidden1").value
= str;
}
</script>
<html>
<head>
<title>How to set c# variable value
in javascript</title>
</head>
<body>
<div>
<asp:hiddenfield id="hdnVlaue" runat="server"></asp:hiddenfield>
<asp:button id="btnClick" runat="server"
onclientclick="SetValue()" onclick="”" text="Click
Me"> </asp:button>
</div>
</body>
</html>
Now in the click event of the btnClick, we will set value
received by JavaScript function
protected void btnClick_Click(object sender, EventArgs e)
{
string sValue = hdnVlaue.Value;
Response.Write("The
Received Value is " + sValue);
}
using System;
using System.Net.Mail;
using System.Net.Security;
public partial class SendEmailPage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
MailMessage oMailMessage = new MailMessage("Your Email Address
", "Recepent’s
Email Address ");
oMailMessage.Subject = "Write Your Mail Here";
oMailMessage.Body = "Write Your Email Message";
oMailMessage.IsBodyHtml = false;
SmtpClient oSmtpClient = new SmtpClient("smtp.gmail.com", 587);
oSmtpClient.Credentials = new System.Net.NetworkCredential("Email Username", "Email Password");
oSmtpClient.EnableSsl = true;
oSmtpClient.Send(oMailMessage);
}
}
using System;
using System.Web;
using System.Web.UI;
public partial class GetDeviceType : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected override void OnInit(EventArgs e)
{
string sUserAgent = Request.UserAgent.ToLower();
if (sUserAgent.Contains("tablet"))
{
this.MasterPageFile = "/Tablet.master";
}
else
{
this.MasterPageFile = "/Mobile.master";
}
}
}