title: Incorrect syntax near the keyword 'close'
body: <p>I have a section of code in one of my scripts that is getting an error in its syntax.</p>
  
  <pre><code>if(status &lt;&gt; true and Request.QueryString("selectId") = "undefined") then
  strConn ="PROVIDER=foobar;Server=foo;Database=foo;Uid=bar;Pwd=bar;"
  Set cnt = Server.CreateObject("ADODB.Connection")
  set rs1 = CreateObject("ADODB.Recordset") 
  rs1.CursorLocation = adUseClient
  cnt.ConnectionString= strConn
  cnt.Open strConn
  
  sql="Select * from rule1 where skucode='" &amp; Request.Form("txthidden") &amp; "' and letter1id  ='" &amp; Request.Form("lrt1") &amp; "' and letter2id ='" &amp; Request.Form("Select1") &amp; "' and letter3id ='" &amp; Request.Form("Select2") &amp; "'"
  rs1.Open  sql,cnt,2,2
  if not rs1.EOF then
  Response.write("&lt;script language=""javascript""&gt;alert('Rules already exists!');&lt;/script&gt;")
  else
  
    sql="INSERT INTO rule1 (letter1id,letter2id,letter3id,HTML,skucode) VALUES "
    sql=sql &amp; "('" &amp; Request.Form("lrt1") &amp; "',"
    sql=sql &amp; "'" &amp; Request.Form("Select1") &amp; "',"
    sql=sql &amp; "'" &amp; Request.Form("Select2") &amp; "',"
    sql=sql &amp; "'" &amp; Request.Form("txthtml") &amp; "',"
    sql=sql &amp; "'" &amp; Request.Form("txthidden") &amp; "')"  
  cnt.Execute sql
   Response.write("&lt;script language=""javascript""&gt;alert('Rules Added successfully!');window.location='" &amp; "viewrule1.asp?skucodes=" &amp; Request.Form("txthidden") &amp;   "';&lt;/script&gt;")
  end if
  rs1.Close
  cnt.close
  </code></pre>
  
  <p>The error message I get is:</p>
  
  <pre><code>Microsoft OLE DB Provider for SQL Server error '80040e14'
  
  Incorrect syntax near the keyword 'close'.
  
  /path/file.asp, line 75
  </code></pre>