ajax增删改查JSON数据

ajax增删改查JSON数据
ajax增删改查JSON数据

1.

2.

3.jQuery实例

4.

7.

91.

92.

93.

jQuery实例--Ajax信息的增删改查等操作

94.

学生信息

95.

96.

97.

98.

99.

100.

101.

102.

103.

104.

105.

学号姓名性别年龄

班级号操作

106.

107.

108.

109.

110.

111.

144.

145.

146.

147.

数据库的增删改查(精)

学习收藏数据库增删改查 --查询信息系和计算机系的学生,并按学生所在系和学号排序。select sno,sname,Sdept from Student where Sdept='CS'OR Sdept='IS' order by Sdept,sno ASC --查询学生表中最小的年龄。 select MIN(sage from student --查询课程名中包含“数据”的课程名。 select cno,cname from course where Cname like'%数据%' --查询先行课程为空值的课程号、课程名及学分 select cno,cname,ccredit from Course where Cpno is null --查询李勇选修的数据库课程的成绩 select grade from SC where Sno=(select Sno from Student where Sname='李勇'and Cno=(select Cno from Course where cname='数据库' --查询平均成绩分以上的学生的学号 select distinct sno from SC scx where (select AVG(Grade from SC scy

where scy.sno=scx.Sno>85 --求计算机系没有选修数据库课程的学生姓名 select sname from Student where Sno not in(select Sno from SC where Cno in(select Cno from Course where Sname='数据库'and Sdept='IS' --求至少选修了学号为S1所选修的全部课程的学生学号 select distinct sno from SC scx where not exists(select*from SC scy where scy.Sno='20021522'and not exists(select* from sc scz where scz.sno=scx.sno and https://www.360docs.net/doc/6614043586.html,o=https://www.360docs.net/doc/6614043586.html,o --求各系的系的学生人数的,并将结果按学生人数的降序排序 select Sdept,COUNT(sno from Student group by Sdept order by Sdept ASC --查询选修了数学课程并且成绩高于该门课程平均分的学生学号和成绩 select sno,grade from SC scx where Grade>=(select AVG(Grade from SC scy where Cno=(select Cno from Course where Cname='数学'and Cno=(select Cno from Course

后台转换JSON数据类型,前台解析JSON数据等等例子总结

后台转换JSON数据类型,前台解析JSON数据等等例子总结 JSON对象: JSONObject obj = new JSONObject(); obj.put("result", 0); obj.put("message", message); return obj.toJSONString(); 前台解析: Success:function(data){ var result = data.result; var message = data.message; } json对象中有json对象的写法: Objstr为一个JSONObject obj的String转换 private String getsuccess(String objstr,int number){ JSONObject obj = new JSONObject(); obj.put("result", 1); obj.put("obj", objstr); obj.put("number", number); return obj.toJSONString(); }

前台解析: Picjson为success返回的data var result = picjson.result; if (result==1) { var objdata = picjson.obj; var data = eval('(' + objdata + ')'); var num = picjson.number; picurl = null; showpiclist(data, num); } else{ alert(picjson.message); picurl = null; } list转成json对象 需要的包: https://www.360docs.net/doc/6614043586.html,mons-lang.jar https://www.360docs.net/doc/6614043586.html,mons-beanutils.jar https://www.360docs.net/doc/6614043586.html,mons-collections.jar https://www.360docs.net/doc/6614043586.html,mons-logging.jar

数据库增删改查基本语句

数据库增删改查基本语句 adoquery1.Fielddefs[1].Name; 字段名 dbgrid1.columns[0].width:=10; dbgrid的字段宽度 adoquery1.Fields[i].DataType=ftString 字段类型 update jb_spzl set kp_item_name=upper(kp_item_name) 修改数据库表中某一列为大写select * from master.dbo.sysobjects ,jm_https://www.360docs.net/doc/6614043586.html,ers 多库查询 adotable1.sort:='字段名称ASC' adotable排序 SQL常用语句一览 sp_password null,'新密码','sa' 修改数据库密码 (1)数据记录筛选: sql="select * from 数据表where 字段名=字段值orderby 字段名[desc] " sql="select * from 数据表where 字段名like '%字段值%' orderby 字段名[desc]" sql="select top10 * from 数据表where 字段名orderby 字段名[desc]" sql="select * from 数据表where 字段名in('值1','值2','值3')" sql="select * from 数据表where 字段名between 值1 and 值2" (2)更新数据记录: sql="update 数据表set 字段名=字段值where 条件表达式" sql="update 数据表set 字段1=值1,字段2=值2……字段n=值n where 条件表达式" (3)删除数据记录: sql="delete from 数据表where 条件表达式" sql="delete from 数据表"(将数据表所有记录删除) (4)添加数据记录: sql="insert into 数据表(字段1,字段2,字段3…) values(值1,值2,值3…)" sql="insert into 目标数据表select * from 源数据表"(把源数据表的记录添加到目标数据表)

jQuery+AJAX+JSON

jQuery 1. 什么是jQuery?? jQuery是一个优秀的JavaScript框架,一个轻量级的JavaScript类库。 jQuery的核心理念是Write less,Do more。 使用jQuery可以兼容各种浏览器,方便的处理HTML、Events、动画效果等,并且方便的为网站提供AJAX交互。 2.jQuery的特点: 利用选择器来查找要操作的节点,然后将这些节点封装成一个jQuery对象,通过调用jQuery对象的方法或者属性来实现对底层被封装的节点的操作。 好处:a、兼容性更好;b、代码更简洁 3.编程步骤: step1、使用选择器查找节点 step2、调用jQuery的属性和方法 4.jQuery对象与DOM对象之间的转换 1. 什么是jQuery对象?? jQuery对象是jQuery对底层对象的一个封装,只有创建了这个对象,才能使用类库中提供的方法。 2. DOM对象 ----> jQuery对象 DOM对象向jQuery对象的转变很容易,外面追加$和圆括号即可。 function f( ){ var obj = document.getElementById(‘d1’); //DOM -> jQuery对象

var $obj = $(obj); $obj.html(‘hello jQuery’); } 3. jQuery对象 ----> DOM对象 jQuery对象向DOM对象转化,通过调用get方法加参数值0即可$obj.get(0)。 function f( ){ var $obj = $(‘#d1’); //jQuery对象 -> DOM var obj = $(obj).get (0); obj.innerHTML = ‘hello jQuery’; } 5. jQuery选择器 1. 什么是jQuery选择器?? jQuery选择器是一种类似CSS选择器的特殊说明符号,能够帮助jQuery 定位到要操作的元素上,使用了选择器可以帮助HTML实现内容与行为的分离。只需要在元素上加上Id属性。 2. 选择器的种类 a、基本选择器 #id根据指定的ID匹配一个元素 .class根据指定的类匹配一个元素 element根据的指定的元素名匹配所有的元素

SQL数据库中的增删改查总结1

一、增:有2种方法 1.使用insert插入单行数据: 语法:insert [into]<表名> [列名] values <列值> 例:insert into Strdents (姓名,性别,出生日期) values ('邢金聪','男','1990/6/15') 注意:如果省略表名,将依次插入所有列 2.使用insert,select语句将现有表中的数据添加到已有的新表中 语法:insert into <已有的新表> <列名> select <原表列名> from <原表名> 例:insert into addressList ('姓名','地址','电子邮件')selectname,address,email from Strdents 注意:查询得到的数据个数、顺序、数据类型等,必须与插入的项保持一致 二、删:有2中方法 1.使用delete删除数据某些数据 语法:delete from <表名> [where <删除条件>] 例:delete from awhere name='邢金聪'(删除表a中列值为邢金聪的行) 注意:删除整行不是删除单个字段,所以在delete后面不能出现字段名 2.使用truncate table 删除整个表的数据

语法:truncate table<表名> 例:truncate table addressList 注意:删除表的所有行,但表的结构、列、约束、索引等不会被删除;不能 用于有外建约束引用的表 三、改 使用update更新修改数据 语法:update <表名> set <列名=更新值> [where <更新条件>] 例:truncate table addressList 注意:删除表的所有行,但表的结构、列、约束、索引等不会被删除;不能 用于有外建约束引用的表 四、查 1.普通查询 语法:select <列名> from <表名> [where <查询条件表达试>] [order by<排序的列 名>[asc或desc]] 1).查询所有数据行和列 例:select * from a 说明:查询a表中所有行和 2).查询部分行列--条件查询 例:select i,j,kfrom a where f=5 说明:查询表a中f=5的所有行,并显示i,j,k3列

Jquery Ajax 异步处理Json数据

啥叫异步,啥叫Ajax.咱不谈啥XMLHTTPRequest.通俗讲异步就是前台页面javascript能调用后台方法.这样就达到了无刷新.所谓的Ajax.这里我们讲二种方法 方法一:(微软有自带Ajax框架) 在https://www.360docs.net/doc/6614043586.html,里微软有自己的Ajax框架.就是在页面后台.cs文件里引入 using System.Web.Services 空间然后定义静态方法(方法前加上 [WebMethod]) [WebMethod] public static string ABC(string ABC) { return ABC; } 好了,现在我们谈谈前台Js怎么处理后台返回的数据吧,可利用Jquery处理返回的纯html,json,Xml等数据.这里我们演示返回返回的数据有string、集合(List<>)、类. 但都返回Json格式(Json轻量级比XML处理起来简单).看看前台是怎么解析这些数据的. 代码如下: 前台页面: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %> 无标题页