Sorting issue.

Results 1 to 3 of 3

Thread: Sorting issue.

  1. #1
    Conrad Guest

    Default Sorting issue.

    I am trying to do a simple SQL statment using ADO. The problem arises when I try to do a SORT.<BR><BR>The code:<BR><BR> Set obj_connect = Server.CreateObject("ADODB.connection")<BR> Set obj_record = Server.CreateObject("ADODB.recordset")<BR> str_sql = "SELECT * FROM Phone WHERE State=&#039" & spp &"&#039 SORT BY city"<BR> obj_connect.Open "DSN=foobar;UID=foo;PWD=bar"<BR> obj_record.Open str_sql, obj_connect, 3,, 1 &#039 = adOpenStatic,,adCmdText<BR><BR>The error:<BR><BR>Error Type:<BR>Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)<BR>[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near &#039SORT&#039.<BR>/users/dialup/choose_number.asp, line 41<BR><BR>I do not understand why I get the error. If I run the same query under Query Analyzer I receive no error.<BR>The variable is returning a value.<BR><BR>Thank you for any help you may render.<BR><BR>Conrad

  2. #2
    Join Date
    Dec 1969
    Los Angeles, CA

    Default Ordering issue.

    try ORDER BY

  3. #3
    Conrad Guest

    Default Doh!

    I think I am going to change my career.<BR>"Would you like frys with that order?"<BR><BR>Thanks.

Posting Permissions

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