add ------------------------------------sqldataadapter ad = new sqldataadapter("select id,name from name", con); sqlcommandbuilder cb = new sqlcommandbuilder(ad); dataset ds = new dataset(); ad.fill(ds, "name"); response.write("before change:{0}"+ds.tables["name"].rows.count); datacolumn[] keys = new datacolumn[1]; keys[0] = ds.tables["name"].columns["id"]; response.write("{0}"+ keys[0]); ds.tables["name"].primarykey = keys; //response.write("enter the id do u want to find"); datarow findrow = ds.tables["name"].rows.find(int32.parse(textbox1.text)); if (findrow == null) { datarow insrow = ds.tables["name"].newrow(); //response.write("enter the id and name"); insrow["id"] = int32.parse(textbox1.text); insrow["name"] = textbox2.text; ds.tables["name"].rows.add(insrow); if ((findrow = ds.tables["name"].rows.find(insrow["id"])) != null) { response.write("added"); } } else { response.write("already present"); } ad.update(ds, "name"); response.write("rows after change:{0}"+ ds.tables["name"].rows.count); display(); con.close(); ------------------------------------delete ------------------------------------sqldataadapter ad = new sqldataadapter("select id,name from name", con); sqlcommandbuilder cb = new sqlcommandbuilder(ad); dataset ds = new dataset();
//
ad.fill(ds, "name"); response.write("before change:{0}"+ ds.tables["name"].rows.count); datacolumn[] keys = new datacolumn[1]; keys[0] = ds.tables["name"].columns["id"]; response.write("{0}"+ keys[0]); ds.tables["name"].primarykey = keys; response.writeline("enter the id do u want to find"); datarow findrow = ds.tables["name"].rows.find(int32.parse(textbox1.text)); if (findrow == null) { response.write("couldnsinglequotet find"); } else { response.write("present in table");
response.write("{0}"+ findrow["name"]); findrow.delete(); ad.update(ds, "name"); response.write("deleted"); display(); } con.close(); //response.readline(); ------------------------------------search ------------------------------------sqldataadapter ad = new sqldataadapter("select id,name from name", con); sqlcommandbuilder cb = new sqlcommandbuilder(ad); dataset ds = new dataset(); ad.fill(ds, "name"); response.write("before change:{0}"+ ds.tables["name"].rows.count); datacolumn[] keys = new datacolumn[1]; keys[0] = ds.tables["name"].columns["id"]; response.write("{0}"+ keys[0]); ds.tables["name"].primarykey = keys; //response.writeline("enter the id do u want to find"); datarow findrow = ds.tables["name"].rows.find(int32.parse(textbox1.text)); if (findrow == null) { response.write("not available"); } else { response.write("present in table"); response.write("{0}"+ findrow["name"]); /*findrow.delete(); ad.update(ds, "name"); response.writeline("deleted"); display();*/ } con.close(); //response.readline(); ------------------------------------display ------------------------------------sqldataadapter ad = new sqldataadapter("select id,name from name", con); dataset ds = new dataset(); ad.fill(ds, "name"); foreach (datarow therow in ds.tables["name"].rows) { response.write(therow["id"] + "\t" + therow["name"]); } con.close(); response.write("program finished");
------------------------------------update ------------------------------------sqldataadapter ad = new sqldataadapter("select id,name from name", con); sqlcommandbuilder cb = new sqlcommandbuilder(ad); dataset ds = new dataset(); int a; ad.fill(ds, "name"); response.write("before change:{0}"+ ds.tables["name"].rows.count); datacolumn[] keys = new datacolumn[1]; keys[0] = ds.tables["name"].columns["id"]; response.write("{0}"+ keys[0]); ds.tables["name"].primarykey = keys; response.write("enter the id"); datarow findrow = ds.tables["name"].rows.find(a = int32.parse(textbox1.text)); if (findrow == null) { response.write("not present"); /*datarow insrow = ds.tables["name"].newrow(); //response.write("enter the id and name"); insrow["id"] = a;//int32.parse(response.readline()); insrow["name"] = response.readline(); ds.tables["name"].rows.add(insrow); if ((findrow = ds.tables["name"].rows.find(insrow["id"])) != null) { response.write("added"); }*/ } else { int b = 0, c, f = 0; foreach (datarow therow in ds.tables["name"].rows) { c = system.convert.toint32(therow["id"]); if (c == a) { b++; f = 1; break; } else b++; } response.write("present in{0}"+ b); if (f == 1) { //textbox2.text="enter the name to change"; ds.tables["name"].rows[b - 1]["name"] = textbox2.text; ad.update(ds, "name"); display(); } //con.close(); }
//
//ad.update(ds, "name"); //response.write("rows after change:{0}", ds.tables["name"].rows.count); //display(); con.close(); response.readline();
------------------------------------alert ------------------------------------button1.attributes["onclick"] = "javascript:alert(singlequoteinsertedsinglequote)"; ------------------------------------clue ------------------------------------singlequote to symbolsinglequote ------------------------------------grid ------------------------------------sqldataadapter da = new sqldataadapter("select * from login", con); dataset ds = new dataset(); da.fill(ds, "login"); gridview1.datasource = ds; gridview1.databind(); ------------------------------------deleteg ------------------------------------sqldataadapter da = new sqldataadapter("delete login where username=singlequote"+dropdownlist1.selecteditem.text+"singlequote", con); dataset ds = new dataset(); da.fill(ds, "login"); //gridview1.datasource = ds; //gridview1.databind(); display(); ------------------------------------insertg ------------------------------------sqldataadapter da = new sqldataadapter("insert into login values(singlequote"+textbox1.text+"singlequote,singlequote"+textbox2.text+"singleq uote)", con); dataset ds = new dataset(); da.fill(ds, "login"); //gridview1.datasource = ds; //gridview1.databind(); display(); button1.attributes.add("onclick", "alert(singlequotehaisinglequote)"); -------------------------------------
messagebox ------------------------------------------------------------------------bobby and madprocedure for menu in cs.txt 1. 2. 3.
file -> new -> asp.net web site add new item-> webforms(2), sitemap(1) edit web.sitemap as follows
<sitemap xmlns="http://schemas.microsoft.com/aspnet/sitemap-file-1.0" > <sitemapnode url="default.aspx" title="home" description=""> <sitemapnode url="default2.aspx" title="page_1" description="" /> <sitemapnode url="default3.aspx" title="page_2" description="" /> 4. drag and drop menu from navigation toolbox and sitemap datasource from data tool box 5. 6.
in menu properties choose data source as sitemapdatasource1