Solved

Error with Parameterized Query

Posted on 2006-11-15
2
397 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
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Classic ASP error- Object required: 'objFolder' 6 39
INNER JOIN ? 8 45
ASP SQL Syntax Duplicate Key 7 101
RegEx Help - open to other simple suggestions 8 51
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…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

813 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now