Solved

Error with Parameterized Query

Posted on 2006-11-15
2
402 Views
Last Modified: 2012-05-05
I have a parameterized Query, but can't figure out this error.

--------------------------
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]Parameterized Query '(@P1 text,@P2 datetime,@P3 text,@P4 int,@P5 text,@P6 text,@P7 te' expects parameter @P11, which was not supplied.

/admin/report2.asp, line 85


Line 85 is for:  .Execute lngRecs, , adExecuteNoRecords
---------------------------

Here's the code
-------------------------------------------------------

if request.form("formsubmit") = "true" Then
'Open Database Connection
Set openConn = Server.CreateObject("ADODB.Connection")
openPath= "Driver={SQL Server};" & _
           "Server=(local);" & _
           "Database=KlineGroup;" & _
             "Trusted_Connection=yes"
openConn.open openPath
openConn.close 'make sure old connections are cleaned out
openConn.open openPath
Set cmd = Server.CreateObject("ADODB.Command")
With cmd
    .ActiveConnection = openConn
    .CommandText = "INSERT into report (rp_title, rp_date, rp_desc, rp_category, rp_code, rp_link_page, rp_link_brochure, rp_link_subscribe, rp_year_start, rp_year_end, rp_n_america, rp_latin, rp_e_europe, rp_w_europe, rp_middle_east, rp_asia) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);"
    .CommandType = adCmdText
    .Parameters.Append .CreateParameter("@rp_title", adLongVarChar, adParamInput, -1)    
    .Parameters("@rp_title") = request.Form("title")
     rp_date_month = request.Form("releasedate_month")
     rp_date_day = request.Form("releasedate_day")
     rp_date_year = request.Form("releasedate_year")
     rp_date = rp_date_month & "/" & rp_date_day & "/" & rp_date_year
    .Parameters.Append .CreateParameter("@rp_date", adDBTimeStamp, adParamInput)
    .Parameters("@rp_date") = rp_date

    .Parameters.Append .CreateParameter("@rp_desc", adLongVarChar, adParamInput, -1)
    .Parameters("@rp_desc") = request.Form("description")

     rp_category = request.Form("category")
    .Parameters.Append .CreateParameter("@rp_category", adInteger, adParamInput)
    .Parameters("@rp_category") = request.Form("category")

    .Parameters.Append .CreateParameter("@rp_code", adLongVarChar, adParamInput, -1)
    .Parameters("@rp_code") = cleantext(request.Form("code"))

    .Parameters.Append .CreateParameter("@rp_link_page", adLongVarChar, adParamInput, -1)
    .Parameters("@rp_link_page") = request.Form("link_page")

     rp_link_brochure = request.Form("link_brochure")
    .Parameters.Append .CreateParameter("@rp_link_brochure", adLongVarChar, adParamInput, -1)
    .Parameters("@rp_link_brochure") = request.Form("link_brochure")

     rp_link_subscribe = request.Form("link_subscribe")
    .Parameters.Append .CreateParameter("@rp_link_subscribe", adLongVarChar, adParamInput, -1)
    .Parameters("@rp_link_subscribe") = request.Form("link_subscribe")

    .Parameters.Append .CreateParameter("@rp_year_start", adInteger, adParamInput)
    .Parameters("@rp_year_start") = request.Form("year_start")

    .Parameters.Append .CreateParameter("@rp_year_end", adInteger, adParamInput)
    .Parameters("@rp_year_end") = request.Form("year_end")

     rp_n_america = request.Form("n_america")
    .Parameters.Append .CreateParameter("@rp_n_america", adBoolean, adParamInput)
    .Parameters("@rp_n_america") = request.Form("n_america")

     rp_latin = request.Form("latin")
    .Parameters.Append .CreateParameter("@rp_latin", adBoolean, adParamInput)
    .Parameters("@rp_latin") = request.Form("latin")

    .Parameters.Append .CreateParameter("@rp_e_europe", adBoolean, adParamInput)
    .Parameters("@rp_e_europe") = request.Form("e_europe")

     rp_w_europe = request.Form("w_europe")
    .Parameters.Append .CreateParameter("@rp_w_europe", adBoolean, adParamInput)
    .Parameters("@rp_w_europe") = request.Form("w_europe")

     rp_middle_east = request.Form("middle_east")
    .Parameters.Append .CreateParameter("@rp_middle_east", adBoolean, adParamInput)
    .Parameters("@rp_middle_east") = request.Form("middle_east")

     rp_asia = request.Form("asia")
    .Parameters.Append .CreateParameter("@rp_asia", adBoolean, adParamInput)
    .Parameters("@rp_asia") = request.Form("asia")
     
    .Execute lngRecs, , adExecuteNoRecords

End With

     Set cmd = Nothing
     Set RS = openConn.Execute(SQL_query)
     Set RS = Nothing
End if
0
Comment
Question by:bsowards
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 22

Accepted Solution

by:
WMIF earned 500 total points
ID: 17950508
im assuming that the form field for this is a checkbox?
request.Form("n_america")



if so, the checkbox is only sent to the next page if it is checked.  so you need to check for it, then supply the value.

if request.Form("n_america") = "" then
  rp_n_america = false
else
  rp_n_america = true
end if
.Parameters.Append .CreateParameter("@rp_n_america", adBoolean, adParamInput)
.Parameters("@rp_n_america") = rp_n_america
0
 

Author Comment

by:bsowards
ID: 17950579
Thank you! can't believe i didn't see that.
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question