|
-
Jan 6th, 2004, 10:57 AM
#1
Thread Starter
Hyperactive Member
Help! Too few parameters. Expected 2.
Ok I am doing an SQL insert and I get Too few parameters. Expected 2.
This used to work but another engineer got his hands on the database and changed field names and join types now
I get this error.
I changed all code in my asp page to reflect the field names and I even broke down the sql insert to one field and
it still errors in it. Below is my code.
I also removed all joins in the table so it is a simple insert and still I get the error...
Code:
<!--#include file="Connect.asp" -->
<%
Dim Emp1
Dim Proj
Dim qLevel
Dim pDate
Dim nDef
Dim tTime
Emp1 = CStr(Request("Emp"))
Proj = CStr(Request("ProjName"))
qLevel =Cstr(Request("LTest"))
pDate = CStr(Request("InDate"))
nDef = Cstr(Request("NumDefects"))
tTime = cstr(Request("TestTime"))
'Response.Write(Emp1)& "<br>"
'Response.Write(Proj)& "<br>"
'Response.Write(qLevel)& "<br>"
'Response.Write(pDate)& "<br>"
'Response.Write(tTime) & "<br>"
'Response.Write(nDef)& "<br>"
Function f(N)
ret = Request.Form(N)
ret = Replace(ret, "<", "<")
ret = Replace(ret, ">", ">")
ret = Trim(ret)
ret = Replace(ret, "'", "''")
If Len(ret) > 255 Then
ret = Left(ret, 255)
End If
f = ret
End Function
'Con.Execute("INSERT INTO TAGDB (TAG_NAME, TAG_TEXT, TAG_TIME) VALUES('" & f("Name") & "','" & mkicons(f("Text")) & "','" & Now & "')")
conn.execute("INSERT INTO TrackerQuery(Employee, Project_Name, eDate, TestLevel, Hours, Number_of_Defects_Found)VALUES ('" & Emp1 & "','" & Proj & "','" & pDate & "','" & TTime & "','" & NDef & "','" & qLevel & "')")
'conn.execute("INSERT INTO TrackerQuery(Project_Name)VALUES ('" & Proj & "')")
%>
<HTML>
<head>
<title>Data Submitted</title>
</head>
<body>
<h1 align="center">Thank You For Your Data</h1>
<h2 align="center">You will redirected back to TimeTrackers main page</h2><br><br>
<a href="http://ssd-web/ssd-dashboard2/index.html">NSS Home Page</a>
<meta HTTP-EQUIV=REFRESH Content = "3;url=http://ssd-web/ssd-dashboard2/timetracker/ttmain.asp">
</body>
</html>
-
Jan 6th, 2004, 11:23 AM
#2
The error message indicates that you are using field name/s that dont exist in the database.
Try this
Put this code after the end of Function f()
VB Code:
dim sql
sql="INSERT INTO TrackerQuery(Employee, Project_Name, eDate, TestLevel, Hours, Number_of_Defects_Found)VALUES ('" & Emp1 & "','" & Proj & "','" & pDate & "','" & TTime & "','" & NDef & "','" & qLevel & "')"
response.write sql
response.end
copy the outputed sql and run it in your database(not sure what database are you using) directly. See if that runs, i suspect it wont, and your db should tell you which field name is incorrect. Hope this helps.
Danial
[VBF RSS Feed]
There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.
If I have been helpful, Please Rate my Post. Thanks.
This post was powered by : 
-
Jan 6th, 2004, 11:39 AM
#3
Thread Starter
Hyperactive Member
Thanks
Thank Danial you have put me on the right path! Now I can see what fields are not being submitted.
-Troy
-
Jan 6th, 2004, 11:49 AM
#4
Thread Starter
Hyperactive Member
R
Danial I am using Access how would I run this Query in Access? Unlike SQL there is no Access Query Analyzer that I know of.
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
|
Click Here to Expand Forum to Full Width
|