Too Few Parameters?!

Results 1 to 2 of 2

Thread: Too Few Parameters?!

  1. #1
    chrismcd Guest

    Default Too Few Parameters?!

    I keep getting the message too few parameters from line<BR><BR>objRS.Open strSQL, objConn<BR><BR>&#060;%<BR> Dim objRS, strSQL, strSearch<BR> <BR> strSearch = Trim(Request("search"))<BR> <BR> strSQL = "SELECT skill.jobid FROM job_description, job_skill, skill WHERE job_description.jobid = job_skill.jobid AND job_skill.skill = skill.skill AND skill.description LIKE &#039;%" & strSearch & "%&#039;" <BR><BR> Set objRS = Server.CreateObject("ADODB.Recordset")<BR> objRS.Open strSQL, objConn<BR> <BR> If objRS.EOF then<BR> &#039;No records were returned for the characters entered by the user<BR> Response.Write "There are no positions that contain " & strSearch <BR> Else<BR> &#039;There are one or more positions that meet the condition entered by<BR> &#039;the user. Display these positions...<BR> Response.Write "&#060;B&#062;A Listing of Positions containing " & strSearch & ":&#060;/B&#062;<BR>"<BR> Do While Not objRS.EOF<BR> Response.Write objRS("jobid") & " - " & objRS("description") & "<BR>"<BR><BR> &#039;Move on to the next positions<BR> objRS.MoveNext<BR> Loop<BR> End If <BR> <BR> objRS.Close<BR> Set objRS = Nothing<BR><BR> objConn.Close<BR> Set objConn = Nothing<BR>%&#062;<BR><BR>Where am i going wrong? Any ideas?<BR><BR>Chris

  2. #2
    Medieval Dude Guest

    Default You need joins

    Well, I don&#039;t see the need to have three tables in yer FROM clause when yer only selecting skill.jobid. And if you want to combine tables, use a JOIN instead of throwing the comparisons in the WHERE clause. Try this simplified version for the one field:<BR><BR>strSQL = "SELECT jobid FROM skill WHERE description LIKE &#039;%" & strSearch & "%&#039;" <BR><BR>If you need fields from the other databases, use a JOIN within your FROM like this (I&#039;m using table aliases for simplicity):<BR><BR>FROM job_description jd JOIN job_skill js ON jd.jobid = js.jobid JOIN skill s ON js.skill = s.skill

Posting Permissions

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