天天躁日日躁狠狠躁AV麻豆-天天躁人人躁人人躁狂躁-天天澡夜夜澡人人澡-天天影视香色欲综合网-国产成人女人在线视频观看-国产成人女人视频在线观看

Jquery+WebService 校驗賬號是否已被注冊的代碼

詳細代碼如下:
Default.ASPx
復制代碼 代碼如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.ASPx.cs" Inherits="Ajax_XML._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
<script type="text/Javascript" src="jquery-1.3.2-vsdoc2.js" language="Javascript"></script>
<script type="text/Javascript" language="Javascript">
$(function() {
$("#<%=UserID.ClientID%>").keyup(
function() {
$.ajax({
type: "POST",
contentType: "application/json",
dataType: "json",
url: "WebService1.asmx/UserIsExist",
data: "{UserID:'" + $("#<%=UserID.ClientID%>").val() + "'}",
success: function(result) {
if (result.d == "true")
$("#<%=IsExist.ClientID%>").text("Yes");  //賬號已存在
else
$("#<%=IsExist.ClientID%>").text("No");  
}
});
}
);
})
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<table style="width:100%;">
<tr>
<td>
 </td>
<td>
 </td>
<td>
 </td>
</tr>
<tr>
<td>
 </td>
<td>
<ASP:TextBox ID="UserID" runat="server"></ASP:TextBox>
<ASP:Label ID="IsExist" runat="server" Visible="true"></ASP:Label>
</td>
<td>
 </td>
</tr>
<tr>
<td>
 </td>
<td>
 </td>
<td>
 </td>
</tr>
</table>
</div>
</form>
</body>
</html>

WebService1.asmx.cs
復制代碼 代碼如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Text;
using DAL;
namespace Ajax_XML
{
/// <summary>
/// WebService1 的摘要說明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// 若要允許使用 ASP.NET AJAX 從腳本中調用此 Web 服務,請取消對下行的注釋。
[System.Web.Script.Services.ScriptService]
public class WebService1 : System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld()
{
return "Hello,World!";
}
[WebMethod]
public string UserIsExist(string UserID)
{
string sql = string.Format("select * from Customers where FirstName='" + UserID+"'");
using (SqlDataReader dr = SqlHelper.ExecuteSql(sql))
{
if (dr.Read())
return "false";
else
return "true";
}
}
}
}

SqlHelper.cs
復制代碼 代碼如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
namespace DAL
{
/// <summary>
/// 數據庫操作類
/// </summary>
public class SqlHelper
{
private static SqlConnection conn;
private static SqlCommand comm;
private static SqlDataReader dr;
/// <summary>
/// 打開數據庫連接
/// </summary>
public static void ConnOpen()
{
try
{
conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BBS"].ConnectionString);
conn.Open();
}
catch (Exception e)
{
Console.WriteLine( e.Message);
}
}
/// <summary>
/// 關閉數據庫連接,釋放資源
/// </summary>
public static void ConnClose()
{
if (conn != null)
{
conn.Close();
}
if (comm != null)
{
comm.Dispose();
}
}
public static SqlDataReader ExecuteSql(string sql)
{
SqlHelper.ConnOpen();
comm = new SqlCommand(sql, conn);
try
{
dr = comm.ExecuteReader();
return dr;
}
catch (Exception e)
{
throw e;
}
}
}
}

JavaScript技術Jquery+WebService 校驗賬號是否已被注冊的代碼,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 毛片999| 最近中文字幕完整版免费高清 | 国产亚洲精品久久综合阿香 | 这里只有精品在线视频 | 久久性综合亚洲精品电影网 | 女女破视频在线观看 | 宝贝你骚死哥了好爽 | 91麻豆精品一二三区在线 | 成人免费在线观看视频 | 国产伦精品一区二区三区精品 | 91精品国产入口 | 麻豆高潮AV久久久久久久 | 7m凹凸国产刺激在线视频 | 亚洲麻豆精品成人A在线观看 | 欧美人xxxxx| 亚洲国产精品特色大片观看 | 黑色丝袜美腿美女被躁翻了 | 在线欧美 精品 第1页 | 日本高清在线一区二区三区 | 国产精品久久自在自2021 | 欧美黑人经典片免费观看 | 月夜直播免费观看全集 | 国产 亚洲 日韩 欧美 在线观看 | 国产原创剧情麻豆在线 | 亚洲精品午夜久久久伊人 | 鲁大师影院在线视频在线观看 | 亚洲国产成人精品不卡青青草原 | 国产成人无码精品久久久影院 | 777黄色片 | 日韩伦理电影秋霞影院 | 吃奶摸下的激烈免费视频 | 动漫美女禁区 | 亚洲xxxx动漫 | 美女网站免费久久久久久久 | 日韩一本在线 | 亚洲精品成人AV在线观看爽翻 | 漂亮的保姆3集电影免费观看中文 | 色悠悠电影网 | 中文字幕在线播放 | 香蕉eeww99国产精选播放 | 99久久国产露脸精品麻豆 |