Home Page
Home Page
NET
Prepared By,
S. Manimozhi,
Assistant Professor,
Department of Computer Applications
Bon Secours College for Women,
Thanjavur
SUBSTANCES
Introduction
ASP.NET & Benefits
ASP. NET Controls
Web server controls
Data Controls
Validation Controls
Navigation controls
Ajax Controls
Scripting Languages
Header Files
using System.Data.SqlClient;
using System.Configuration;
using System.Data;
using System.IO;
SQL command with web page interaction
Insert
con.Open();
SqlCommand adp = new SqlCommand(
“ insert into table_name values
('" + this.txtpapertitle.Text + "','" + this.txtauthorname.Text +
"')“ , con);
adp.ExecuteNonQuery();
con.Close();
SQL command with web page interaction
Update
con.Open();
cmd.ExecuteNonQuery();
con.Close();
SQL command with web page interaction
Delete
con.Open();
SqlCommand cmd = new SqlCommand(“delete from
table_name where NAME ='" + this.txtname.text + "' where
Coursecode='" + txtccode.Text + “’", con);
cmd.ExecuteNonQuery();
con.Close();
SQL command with web page interaction
Select Command
SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM course WHERE (year = '“ +
TEXTBOX1.TEXT + "„ ) order by Degreeshortform,Typrofpgm desc", con);
da.Fill(ds);
dt.Columns.Add("S.No");
dt.Columns.Add("Degree");
DataRow dr = dt.NewRow();
dr["Degree"]=ds.Tables[0].Rows[i][0].ToString();
dt.Rows.Add(dr);
GridView1.DataSource = dt;
GridView1.DataBind();
SQL command with web page interaction
Select
adp3.Fill(tbl3);
this.GridView1.DataSource = tbl3;
this.GridView1.DataBind();
Sql command with count
Response.Redirect(Request.RawUrl);
Response.Redirect("16.1_Home.aspx");
ClientScript.RegisterStartupScript(Type.GetType("Sy
stem.String"), "Message", "<script
language='javascript'>alert('Data Added
Successfully);</script>");
Session[“no”]=“23..”;
this.hdempid.Value = Session[“no"].ToString();
Database with Controls
Dropdown list
SqlDataAdapter ad1 = new SqlDataAdapter("Select distinct batchfrom HRM where dcode='" + coursecode + "'", con);
DataSet ds1 = new DataSet();
ad1.Fill(ds1);
if (ds1.Tables[0].Rows.Count > 0)
{
ddlreg.Items.Clear();
ddlreg.Items.Add("Select Regulation");
for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
{
ddlreg.Items.Add(ds1.Tables[0].Rows[i][0].ToString());
}
}
Label
SqlDataAdapter ad = new SqlDataAdapter("Select StudentName from stud where appno='" + textbox1.Text+ "'' ",
con);
DataSet ds = new DataSet();
ad.Fill(ds);
if (ds.Tables[0].Rows.Count > 0)
{
lblname.Text = ds.Tables[0].Rows[0][0].ToString();
}
Thank You