ajaxpro实现无刷新更新数据库【简单方法】
原文发布时间为:2008-10-24 —— 来源于本人的百度文章 [由搬家工具导入]
我用的是AjaxPro.2.dll,然后我想点击那个 “无刷新更新” 那个按钮,实现 无刷新 修改表中的内容
{
alert('提交成功');
document.getElementById("Button2").disabled=false;
document.getElementById("Button2").value="无刷新更新";
}
} </script></head><body> <form id="form1" runat="server"> <div> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br /> <br /> <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox><br /> <br /> <asp:TextBox ID="TextBox3" runat="server" OnTextChanged="TextBox3_TextChanged"></asp:TextBox><br /> <br /> <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="普通更新" /><br /> <br /> <input id="Button2" type="button" value="无刷新更新" onclick="this.disabled=true;this.value='正在提交当中';return gx()"/></div>
</form></body></html>
- C# code
- using System;using System.Data;using System.Configuration;using System.Collections;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using System.Data.SqlClient;using AjaxPro;public partial class Default2 : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { AjaxPro.Utility.RegisterTypeForAjax(typeof(Default2)); } [AjaxPro.AjaxMethod] public bool gengxin(string u,string p,string s) { SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["testConn"].ConnectionString); conn.Open(); SqlCommand cmd = new SqlCommand("Proc_UpdateTest", conn); cmd.CommandType = CommandType.StoredProcedure; SqlParameter[] param = new SqlParameter[3]; param[0] = new SqlParameter("@user", SqlDbType.NChar, 10); param[0].Value = u; param[1] = new SqlParameter("@paper", SqlDbType.NChar, 10); param[1].Value = p; param[2] = new SqlParameter("@score", SqlDbType.NChar, 10); param[2].Value = s; foreach (SqlParameter Parameter in param) cmd.Parameters.Add(Parameter); cmd.ExecuteNonQuery(); //SqlCommand cmd = new SqlCommand("update Paper set paper='" +p + "',score='" + s+"' where user='" +u + "'",conn); //cmd.ExecuteNonQuery(); conn.Close(); return true; } protected void Button1_Click(object sender, EventArgs e) { gengxin(TextBox1.Text,TextBox2.Text,TextBox3.Text); } protected void TextBox3_TextChanged(object sender, EventArgs e) { }}
ajaxpro实现无刷新更新数据库【简单方法】的更多相关文章
- AjaxPro实现无刷新更新数据
使用AjaxPro实现无刷新更新数据 需求 在一个页面动态无刷新的更新后台得到的数据.要想无刷新的更新数据,需要使用Javascript能够获取后台返回的数据,然后通过第三方Javascript库(J ...
- 使用AjaxPro实现无刷新更新数据
需求 在一个页面动态无刷新的更新后台得到的数据.要想无刷新的更新数据,需要使用Javascript能够获取后台返回的数据,然后通过第三方Javascript库(JQuery等)动态更新web页面DOM ...
- [转]jquery 点击表格变为input可以修改无刷新更新数据
原文地址:http://www.freejs.net/article_biaodan_43.html 之前已经发了2篇类似的文章<点击变td为input更新>和<jquery表格可编 ...
- 无刷新更新listview
闲来无事,写点水文吧!有用得着的可以参考下,无刷新更新listview是什么意思呢?举个例子,在订单类listview列表中,常常会有各种订单状态,拿商城类app来说,会有待付款,待收货,确认收货等等 ...
- window.history.pushState与ajax实现无刷新更新页面url
ajax能无刷新更新数据,但是不能更新url HTML5的新API: window.history.pushState, window.history.replaceState 用户操作history ...
- jquery表格可编辑修改表格里面的值,点击td变input无刷新更新表格
td点击后变为input可以输入,更新数据,无刷新更新 演示 XML/HTML Code <table border="0" cellpadding="0" ...
- 本篇文章主要是对jquery+ajax+C#实现无刷新操作数据库数据的简单实例进行了介绍,需要的朋友可以过来参考下,希望对大家有所帮助
我们知道同步执行和异步执行的区别,为了更好的提高用户的体验,我们都会采用异步方式去处理一些问题,毕竟单线程的同步可能回造成卡死等现象,很不友好,所以可以使用ajax来完成用户的体验,现在我们就来说说如 ...
- HTML5 API——无刷新更新地址 history.pushState/replaceState 方法
尽 管是上面讲到的<JavaScript高级程序设计>(第二版)中提到,BOM中的location.path/query…… (window.location)在通过JavaScript更 ...
- 【转】HTML5 API——无刷新更新地址 history.pushState/replaceState 方法
(window.location)在通过JavaScript更改以后,浏览器都会通过刷新来到达你更改后的URL(location的意思就是位 置..) 而在JavaScript MVC开始流行之后,通 ...
随机推荐
- 使用Google Colab训练神经网络(二)
Colaboratory 是一个 Google 研究项目,旨在帮助传播机器学习培训和研究成果.它是一个 Jupyter 笔记本环境,不需要进行任何设置就可以使用,并且完全在云端运行.Colaborat ...
- 【转】数据库SQL的一些总结
http://www.cnblogs.com/yank/category/104903.html
- PJSIP-iOS源码编译
官方文档https://trac.pjsip.org/repos/wiki/Getting-Started/iPhone 功能 在iPhone上可以实现的功能: 包含基于CoreAudio的音频设备, ...
- hibernate的注解
1.many-to-one @ManyToOne @JoinColumn(name = "user_id") 2.many-to-many /** * 双向关联关系中,有且仅有一端 ...
- spring中常用的注解
使用注解来构造IoC容器 用注解来向Spring容器注册Bean.需要在applicationContext.xml中注册<context:component-scan base-package ...
- java在线聊天项目 swt可视化窗口Design 好友列表窗口
熟练使用各种布局方式 FlowLayout 流布局 left center right等 BorderLayout 边框布局 east west sorth north center Absolute ...
- 科普NDIS封包过滤
闲言: 这个月一直在学习NDIS驱动编程,杂七杂八的资料都看个遍了,做了点笔记,捋捋思路,发上来备忘. Ps:只是小菜的一点学习笔记,没什么技术含量,不过版主如果觉得对大家稍微有点帮助的话 ...
- javascript(函数式编程思考) ---> Map-Filter-quicksort-Collatz序列-Flodl-Flodr
let add = x=>x+1; //Map :: ( a -> b) -> [a] -> [b] let Map = function(f,arr){ //闭包存储累积对象 ...
- 【meet in middle】poj1840Eqs
震惊!map的常数居然如此之大 Description Consider equations having the following form: a1x13+ a2x23+ a3x33+ a4x43 ...
- 记服务器 httpd 服务无法启动
httpd 服务无法重启 ,网上查到的资料都是端口号冲突 ,记录一下自己的解决办法 !!! 首先查看 服务状态 : service status httpd / systemctl status h ...