something wrong here.

Results 1 to 3 of 3

Thread: something wrong here.

  1. #1
    Join Date
    Dec 1969

    Default something wrong here.

    intvl="d"<BR>recordSet.Open "SELECT TOP 10 * FROM messages WHERE datediff(intvl,date(),postDate) &#060; 15 ORDER BY postDate DESC",sysConn,1,2,2<BR><BR><BR>when i use this, i get a "syntax error in FROM cause" error, but it works when i take out the "SELECT TOP 10" part... whats wrong with that part? i thought it was right

  2. #2
    Join Date
    Dec 1969

    Default you're removing the SELECT?

    that&#039;d be it then. it&#039;s not clear from the wording of your message, but that&#039;s what you seem to be saying.<BR><BR>j<BR>

  3. #3
    Join Date
    Dec 1969

    Default Teach you to use numbers!

    ...instead of using the mnemonic names!<BR><BR>Translating your OPEN we get:<BR><BR>recordSet.Open SomeSQL, sysConn, adOpenKeyset, adLockPessimistic, adCmdTable<BR><BR><BR>Ummm...explain to me, please, why you are telling poor ADO to use a *TABLE* and then you are passing it SQL???<BR><BR>When you code adCmdTable, ADO expects that you will give it nothing but a table name.<BR><BR>The safest thing to do here is to simply *omit* the last argument to Open. If you do, then ADO is smart enough to figure out what you want.<BR><BR>ALSO...<BR><BR>Why are you locking the database for write if you are going to select 10 records???? Are you *really* going to change every one of those 10 records? That&#039;s what you imply with adLockPessimistic.<BR><BR>If you are only going to read the DB, use adLockReadOnly and save *LOTS* of performance overhead!<BR><BR>SO...<BR><BR>Learn to use the mnemonics instead of the numbers.<BR><BR>

Posting Permissions

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