<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>无标题页</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table align="center" border="1" bordercolordark="#9cc7ef" bordercolorlight="#145aa0"
            cellpadding="4" cellspacing="0" style="width: 90%">
            <tr bgcolor="#d1dcf2">
                <td colspan="2">
                    <div align="center">
                        <font color="#6666ff">员工添加</font></div>
                </td>
            </tr>
            <tr>
                <td nowrap="nowrap" style="width: 164px" width="30">
                    员工编号</td>
                <td width="79%" id="bh">
                    &nbsp;<asp:TextBox ID="bh" runat="server"></asp:TextBox></td>
            </tr>
            <tr>
                <td nowrap="nowrap" style="width: 164px" width="30">
                    密码</td>
                <td width="79%">
                    &nbsp;<asp:TextBox ID="pwd" runat="server"></asp:TextBox></td>
            </tr>以上是添加员工编号的源代码,求大神帮忙修改一下!

解决方案 »

  1.   


     public bool GetID(string 员工编号)
            {
                string sql = "select count(1) from 表名 where 员工编号=@员工编号";
                SqlParameter[] parameters = { new SqlParameter("@员工编号", SqlDbType.VarChar, 50) };
                parameters[0].Value = 员工编号;
                return HelperSQL.Exists(sql.ToString(), parameters); 
           }这个如果数据库已有员工编号就会返回一个true,没有的话false
      

  2.   

    参考:
    http://www.cnblogs.com/insus/archive/2013/05/01/3052604.html
    http://www.cnblogs.com/insus/p/3439599.html