title: Check Database for Null Value - Classic ASP
body: <p>I have a SQL database with the following fields, field A field B field C etc</p>
  
  <p>I need to be able to check if any recordsets have null values but for only the fields i want to have checked, E.G i only want to check field A and B.</p>
  
  <p>I need the script to check all of the RS for the fields i have chosen and if any have a null value i just need this to give me an error or a message.</p>
  
  <p>Something like and if statement</p>
  
  <p>If RS fields not null Do something ELSE
  Do something else
  End if</p>
  
  <p>Any ideas would be great.</p>
  
  <p>Thanks</p>
  
  <p>I now have the following code kind of working!</p>
  
  <pre class="lang-vb prettyprint-override"><code>While ((Repeat2__numRows &lt;&gt; 0) AND (NOT Recordset2.EOF))
  
      If (Recordset2.Fields.Item("compost").Value) = "" OR         (Recordset2.Fields.Item("assessment_period").Value) = "" Then
          Response.Write("This field is Empty")
      Else
          Response.Write("This field is not Empty")
      End If
  
      Repeat2__index=Repeat2__index+1
      Repeat2__numRows=Repeat2__numRows-1
      Recordset2.MoveNext()
  Wend
  </code></pre>
  
  <p>This then gives me the following output</p>
  
  <p>This field is Empty</p>
  
  <p>This field is not Empty </p>
  
  <p>this is because i currently have only 2 recordsets in the DB and one contains data and the other does not. What i need from this is some sort of status indicator that will do the search as above but if it finds an empty field i need just one indicator and not like above where it is displaying text for all the recordsets.</p>