Results 1 to 4 of 4

Thread: SQL

  1. #1
    Join Date
    Dec 1969

    Default SQL

    I&#039ve been working for a while on a code and finaly getting somewere. I now have a problem with SQL: <BR><BR>Microsoft JET Database Engine fout &#039 80040e14&#039 <BR><BR>Syntaxisfout (operator ontbreekt) in query-expressie &#039Validated=True AND Category=&#039. <BR><BR>/link/links1.asp, regel 85 <BR>here&#039s the line:<BR>Set rstemp = CreateObject("ADODB.Recordset")<BR> rstemp.cursorlocation=aduseclient<BR> Set rstemp.ActiveConnection = objConn<BR> rs = ("SELECT * FROM Links WHERE Validated=True AND Category=" & CategoryID & " ORDER BY ClickCount DESC, Name")<BR>Hope someone can help me out<BR><BR><BR>

  2. #2
    Kevin Guest

    Default RE: SQL

    Erika, a few things. Number one. Use Server.CreateObject("ADODB.Recordset") instead of CreateObject.<BR><BR>Just double checking. Do you have a #include line for your connection object?<BR><BR>Finally, a better way to open a recordset which will increase your pages speed and readability would be:<BR><BR>sql = "SELECT * FROM Links WHERE Validated=True AND Category=" & CategoryID & " ORDER BY ClickCount DESC, Name"<BR>Set rsTemp = Server.CreateObject("ADODB.Recordset")<BR>rsTemp.O pen sql, objConn, adOpenStatic, adLockOptimistic, adCmdText<BR><BR>The last line is the most important. I included values for all of the input parameters so that the web server wouldn&#039t have to guess. This gives me the best performance and exactly what I want. A "static" snapshot of the selected records. It also uses row locking (adLockOptimistic) as apposed to table locking (adLockPessimistic) which will allow two or more people to query the same table at the same time.<BR><BR>As for your SQL string, it looks right. So just double check the fields in the database.<BR>

  3. #3
    Join Date
    Dec 1969

    Default RE: SQL

    Erika, see my post in response to crazy... on Friday. I already got this straightened out for you (I think).

  4. #4
    peterjl@austec.net.au Guest

    Default RE: SQL

    I am guessing that the field "Validated" is a text field, in which case you would need quotes around the value "true". If Validated is in fact a boolean, then you don&#039t need "= true".

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts