webserver的使用
首先在頁面上寫上如下代碼:
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Services>
<asp:ServiceReference Path="~/WebServices/PullDataWebService.asmx" />
</Services>
</asp:ScriptManager>
在WebServices的文件夾下建一個(gè)PullDataWebService.asmx,如下所示:
<%@ WebService Language="C#" CodeBehind="~/App_Code/PullDataWebService.cs" Class="PullDataWebService" %>
js中調(diào)用app_code里面的PullDataWebService.cs類的代碼:
var shxm= document.getElementById("xmbh").value;
var shlf= document.getElementById("lpbh").value;
PullDataWebService.FCUpdateData(shxm, shlf,FCCheckCallSuccess);
(FCSaveCallSuccess方法調(diào)用幾個(gè)參數(shù),該方法前面就放幾個(gè)參數(shù))
PullDataWebService用一個(gè)例子來展示寫的方法:
[WebMethod]
[ScriptMethod]
public int FCUpdateData(string sslf, string ssxm)
{
string sqlText = "update fdcjy_jyfcxx set t.oc_shbz='T' ,t.oc_shr='" + 1 + "' , t.dt_shsj =to_date('" + DateTime.Now.ToString() + "','yyyy-mm-dd hh24:mi:ss') where t.oc_xmbh='" + ssxm + "' and t.oc_lpbh='" + sslf + "'";
OracleAccessFDCJY orc = new OracleAccessFDCJY();
int i = orc.ReturnRowsofExecute(sqlText);
return i;
}
接收 webservice返回結(jié)果的js:
// 回調(diào)函數(shù)
function FCCheckCallSuccess(returnInt)
{
if (returnInt == "0")
{
alert("未查到信息,請(qǐng)確認(rèn)后再查詢!");
return;
}
else
{
alert("審核通過!");
return;
}
}
轉(zhuǎn)載于:https://www.cnblogs.com/lff255356/archive/2012/10/31/2747452.html
總結(jié)
以上是生活随笔為你收集整理的webserver的使用的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 论文绘图与合成图片过程中常见问题
- 下一篇: 如何为你的文本标签添加圆点、三角等不规则