如果记录集为空,是否打开jquery对话框?

如果记录集为空,是否打开jquery对话框?,jquery,asp-classic,dialog,dreamweaver,Jquery,Asp Classic,Dialog,Dreamweaver,我试图在我的网页中使用一个对话框。我有一个返回电子邮件地址的记录集 我只希望在记录集为空时打开对话框 这是我的剧本 <script> $(document).ready(function() { $(function() { $( "#dialog-message" ).dialog({ modal: true, autoOpen: false, buttons: { Ok: function() { $(

我试图在我的网页中使用一个对话框。我有一个返回电子邮件地址的记录集

我只希望在记录集为空时打开对话框

这是我的剧本

<script>
$(document).ready(function() {
  $(function() {
    $( "#dialog-message" ).dialog({
      modal: true,
   autoOpen: false,
      buttons: {
        Ok: function() {
          $( this ).dialog( "close" );
        }
      }
    });
  });
  });
  </script>


<div id="body">

 <% If Email.EOF And Email.BOF Then %>

<div id="dialog-message" title="Error No Email address found">
              <p><span class="ui-icon ui-icon-circle-check" style="float:left; margin:0 7px 50px 0;"></span> Error, you don't have an email address linked to your account. </p>
              <p> You cannot request this report</b>. </p>
            </div>

 <% End If ' end Email.EOF And Email.BOF %>

</body>

$(文档).ready(函数(){
$(函数(){
$(“#对话框消息”).dialog({
莫代尔:是的,
自动打开:错误,
按钮:{
好的:函数(){
$(此).dialog(“关闭”);
}
}
});
});
});
错误,您没有链接到帐户的电子邮件地址

您不能请求此报告


上述方法工作正常。它对我不起作用的原因是,我的sql脚本正在返回一个结果,而我希望它什么也不返回

当没有返回任何内容时,我的If语句工作正常

这是全部的

 <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Dim Recordset2
Dim Recordset2_cmd
Dim Recordset2_numRows

Set Recordset2_cmd = Server.CreateObject ("ADODB.Command")
Recordset2_cmd.ActiveConnection = MM_----------_STRING
Recordset2_cmd.CommandText = "SELECT Email FROM dbo.tblusers WHERE UserName = ? AND   Email <> ''" 
Recordset2_cmd.Prepared = true
Recordset2_cmd.Parameters.Append Recordset2_cmd.CreateParameter("param1", 200, 1, 50, Recordset2__varusername) ' adVarChar

Set Recordset2 = Recordset2_cmd.Execute
Recordset2_numRows = 0
%>

<!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">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="shortcut icon" href="../favicon.ico" >
<link rel="icon" type="image/gif" href="../animated_favicon1.gif" >
<title>-------------------</title>

<script>
  $(function() {
    $( "#dialog-message" ).dialog({
      modal: true,
      minWidth: 400,
      closeOnEscape: false,
      my: "center",
      at: "center",
      of: "#targetElement",
      buttons: 
      { 'Go Back': function() { 
         document.location = '/HeadOffice/HeadOfficeMenu.asp'; 
  }, 

      }
    });
  });
  </script>
<body>
<header>
        <div class="content-wrapper">
            <div class="float-left">
                <p class="site-title">
                   ---------- </p>
            </div>

</header>
    <div id="body">
        <asp:ContentPlaceHolder runat="server" ID="FeaturedContent" />

        <section class="content-wrapper main-content clear-fix">
            <asp:ContentPlaceHolder runat="server" ID="MainContent" />
            <table width="200" border="1">
  <tr>
    <td><input type="button" onClick="history.go(-1)" value="Back" class="noprint" /></td>
<td>&nbsp;</td>
  </tr>
</table>
          <p>This Request will be proccessed nightly and emailed.</p>
          <% If Recordset2.EOF And Recordset2.BOF Then %>
            <div id="dialog-message" title="Error No Email address found">
              <p> Error, you don't have an email address linked to your account.<br />
Please contact ---------------------------- and request to have your email added. </p>
              <p> You cannot request this report. </p>
            </div>
            <% End If ' end Recordset2.EOF And Recordset2.BOF %>

      </section>
    </div>

<footer>
        <div class="content-wrapper">
            <div class="float-left">
                <p>------------------
                </p>
            </div>
      </div>
</footer>

</body>
</html>
<%
Recordset2.Close()
Set Recordset2 = Nothing
%>


你能描述一下你遇到的问题吗?即使有电子邮件,对话框是否仍在打开?您是否从未收到电子邮件?对话框是否从未打开?我在开始时使用的代码是正确的,发现没有电子邮件地址时返回的NULL实际上是一个空格“”,我正在检查NULL。。已将所有“”电子邮件地址更新为空,并且工作正常,这让我头疼。@user3339240您好,欢迎使用SO。我很高兴你找到了你问题的答案,请你把它作为一个答案贴出来,并标记为接受(见)。这种做法是积极鼓励的,而且它意味着问题不会出现在未回答的列表中。@user3339240您也没有发布相关代码,看起来问题出在SQL上?