Log in

View Full Version : No value given for one or more required parameters.



yeniuye
02-27-2008, 04:30 AM
I am trying to list 5 most commented news and order them by most commented. I am getting the following error...

No value given for one or more required parameters.





<%
Set objCommentedNews = Server.CreateObject("ADODB.RecordSet")
objCommentedNews.Open "SELECT TOP 5 N.N_ID, N.TITLE, Count(*) as TotalComments FROM NEWS N LEFT JOIN COMMENTS C on C.N_ID = N.N_ID GROUP BY N.N_ID, N.Title ORDER BY TotalComments DESC", objConn, 1, 3

Do While not objCommentedNews.EOF
%>

dsagrera
02-27-2008, 10:14 PM
Most times that error is caused because of a miss spell, could it be "N.ID" instead of "N.N_ID"? Try all named fields and check they're not miss spelled.

yeniuye
02-27-2008, 10:42 PM
I have News and Comments tables in my db file. News table has n_id, title, text, date columns inside. Comments table has com_id, n_id, text columns inside. So I am sure column names are not misspelled.



I also tried to make it work with these codes. I did not get any errors, it takes 5 news from NEWS table but it is not ordering them from most commented to least order. Any help appreciated...


SELECT TOP 5 N.N_ID, N.TITLE FROM NEWS N LEFT JOIN COMMENTS C on C.N_ID = N.N_ID GROUP BY N.N_ID, N.TITLE ORDER BY Count(C.N_ID) ASC