
Order by...
Here's my error and my code. I'm trying to list members with email links, but by last name order. Only the "A"s are showing up but everything else is fine (except this pesky error on my page).<BR><BR>Microsoft VBScript runtime error '800a000d' <BR>Type mismatch: 'ORDER' <BR><BR><% IF first <> "" THEN %><BR><% IF email <> "" THEN %><BR><td width="547" valign="top" align="left" height="30"><BR><a href="<% =email %>"><% =first %>Â*<% =last %></a>Â*Â*<% =city %>Â*<% =state %><BR><BR><% ELSE %> <BR><% ORDER BY =last =first %><BR><b><% =first %>Â*<% =last %></b>Â*Â*<% =city %>Â*<% =state %><BR><BR></tr><tr><BR><% END IF %><% END IF %><BR><BR><BR>Yes, I'm new to SQL commands, does it show really bad?

*What* SQL commands?
You don't have one tiny bit of SQL in there.<BR><BR>The SQL code should be *WAY* above the point you are showing in your code.<BR><BR>Outside the loop on the records (which you also aren't showing.)<BR><BR>Show your SQL then maybe we can make sense of it.<BR><BR>

RE: *What* SQL commands?
<% Set Conn = Server.CreateObject("ADODB.Connection")<BR> Conn.Open DBDSN<BR> <BR> SQL = "SELECT FirstName, LastName, Email, City, State, Car1, Car1Graphic, Car2, Car2Graphic, Car3, Car3Graphic, Car4, Car4Graphic, Car5, Car5Graphic, Car6, Car6Graphic, Car7, Car7Graphic, Car8, Car8Graphic, Car9, Car9Graphic FROM tblMembers ORDER BY LastName, FirstName;"<BR> <BR> ' Response.Write(sql)<BR> ' Response.end<BR> Set RS = Conn.Execute(SQL)<BR> If Not RS.EOF Then<BR> MemberArray = RS.Getrows<BR> RS.Close<BR> Set RS = Nothing<BR> Else<BR> Set RS = Nothing<BR> End If<BR> <BR> Conn.Close<BR> Set Conn = Nothing%><BR><BR> <% FOR x = 0 TO UBound(MemberArray, 2) <BR> first = MemberArray(0, x)<BR> last = MemberArray(1, x)<BR> email = MemberArray(2, x)<BR> city = MemberArray(3, x)<BR> state = MemberArray(4, x)<BR> car1 = MemberArray(5, x)<BR> car1pic = MemberArray(6, x)<BR> car2 = MemberArray(7, x)<BR> car2pic = MemberArray(8, x)<BR> car3 = MemberArray(9, x)<BR> car3pic = MemberArray(10, x)<BR> car4 = MemberArray(11, x)<BR> car4pic = MemberArray(12, x)<BR> car5 = MemberArray(13, x)<BR> car5pic = MemberArray(14, x)<BR> car6 = MemberArray(15, x)<BR> car6pic = MemberArray(16, x)<BR> car7 = MemberArray(17, x)<BR> car7pic = MemberArray(18, x)<BR> car8 = MemberArray(19, x)<BR> car8pic = MemberArray(20, x)<BR> car9 = MemberArray(21, x)<BR> car9pic = MemberArray(22, x) %> <BR> </font></b> <BR> </p><BR> </td><BR> </tr><BR> <BR> <tr><BR> <BR><% IF first <> "" THEN %><BR><% IF email <> "" THEN %><BR><td width="547" valign="top" align="left" height="30"><BR><a href="<% =email %>"><% =first %> <% =last %></a>  <% =city %> <% =state %><BR><BR><% ELSE %> <% ORDER BY =last =first %><BR><b><% =first %> <% =last %></b>  <% =city %> <% =state %><BR><BR> </tr><tr><BR> <% END IF %><% END IF %><BR> <BR> <% IF car1 <> "" THEN %><BR> <% IF car1pic <> "" THEN %><BR> <fontface="verdana">Car(s): </font><BR> <a href="<% =car1pic %>">(<% =car1 %>)</a> <BR> <% ELSE %><BR> <fontface="verdana">Car(s): </font><BR> (<% =car1 %>) <BR> <%END IF%><%END IF%><BR> <BR> <% IF car2 <> "" THEN %><BR> <% IF car2pic <> "" THEN %><BR> <a href="<% =car2pic %>">(<% =car2 %>)</a> <BR> <% ELSE %><BR> (<% =car2 %>) <BR> <%END IF%><%END IF%><BR><BR>

So your SQL is fine...
... and the only thing wrong is your bogus VBScript code.<BR><BR>Just remove this chunk of code:<BR> <% ORDER BY =last =first %><BR>and see what happens.<BR><BR>I still can't figure out what you were trying to do with that. Were you simply trying to make a comment "here's where the order by is used"? Or something like that?<BR><BR>But certainly the error message was clear enough. "ORDER" is not a legal VBScript statement, so you got a syntax error.<BR><BR>The rest of the code could be compacted a whole bunch, but that's immaterial.<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

Forum Rules

