Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Too few parameters?? 3

Status
Not open for further replies.

dashusa

Programmer
Mar 27, 2006
46
US
Hello i am trying to view a table But i want to only view the Data of a specific fieldset.
I collect the name of the fieldset from a form but when i try to view the data it gives me an error saying
"Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
/Trod/Report.asp, line 14
"


this is the code:
Code:
<%@ LANGUAGE="JScript"%>
<!-- #include file="adojavas.inc" -->
<HTML>
<HEAD>
<TITLE>Admin View</TITLE>
</HEAD>
<%

var user = Request.Form("ReportView")

var conn = Server.CreateObject("ADODB.Connection");
	var recordSet = Server.CreateObject("ADODB.RecordSet");
	conn.Open("DSN=excuse");
	recordSet.Open("select * from Details"  +" where User =" + user + "",conn,adOpenKeyset,adLockOptimistic);
 %>
<BODY>
<h1>REPORT FOR <%=user%></h1>
<table border="1" width="100%" bgcolor="#9999ff" bordercolor="#000000" cellpadding="3" cellspacing="3">
 <tr>
 <th>ID</th>
 <th>First Name</th>
 <th>Last Name</th>
 <th>Address 1</th>
 <th>Address 2</th>
 <th>City</th>
 <th>State</th>
 <th>Zip</th>
 <th>Phone Number</th>
 <th>E mail Address</th>
 <th>User Name</th>
 <th>Password</th>
 <th>Date Joined</th>
 <th>Date of Birth</th>
 <th>Agreed</th>
 </tr>
 <%
 while(!recordSet.EOF)
 {
 %>
 <tr>
 <td><font size="-1"><%=recordSet("ID")%></font></td>
 <td><font size="-1"><%=recordSet("FirstName")%></font></td>
 <td><font size="-1"><%=recordSet("LastName")%></font></td>
 <td><font size="-1"><%=recordSet("Address1")%></font></td>
 <td><font size="-1"><%=recordSet("Address2")%></font></td>
  <td><font size="-1"><%=recordSet("City")%></font></td>
   <td><font size="-1"><%=recordSet("State")%></font></td>
   <td><font size="-1"><%=recordSet("Zip")%></font></td>
   <td><font size="-1"><%=recordSet("PhoneNumber")%></font></td>
   <td><font size="-1"><%=recordSet("Email")%></font></td>
   <td><font size="-1"><%=recordSet("User")%></font></td>
   <td><font size="-1"><%=recordSet("Pass")%></font></td>
   <td><font size="-1"><%=recordSet("Date")%></font></td>
   <td><font size="-1"><%=recordSet("DateofBirth")%></font></td>
   <td><font size="-1"><%=recordSet("Agreement")%></font></td>
</font></tr>
<%
recordSet.MoveNext();
}
recordSet.Close();
conn.Close();
%>
	</script>
</table>
</BODY>
</HTML>



Thanks
David
 
I expect User is text. If so, try:
Code:
 recordSet.Open("select * from Details where User ='" & user & "'",conn,adOpenKeyset,adLockOptimistic);


Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Thanks for the quick reply
it now says:
Code:
Error Type:
ADODB.Recordset (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
/Trod/Report.asp, line 14
 
Instead of adOpenKeyset, pass in a 1...and instead of adLockOptimistic, pass in a 3.
 
I believe that User is a reserved word in Access SQL. Try
Code:
recordSet.Open("select * from Details Where [COLOR=red][b][[/b][/color]User[COLOR=red][b]][/b][/color] =" + user ,conn,adOpenKeyset,adLockOptimistic);
 
Thanks i tried
Code:
recordSet.Open("select * from Details"  +" where [User] =" + user + "",conn,1,3,adCmdText);

Still not working
 
Try:

recordSet.Open("select * from Details" +" where [User] ='" + user + "'",conn,1,3,adCmdText);


Hope this helps.


[vampire][bat]
 
You're dealing with script code here...so you can't use the enumeration names for the CursorType, LockType, adn CommandType...you must use their associated integer values.
 
WHHHOOOOOOOOO
THANKS VERY MUCH!!!!
Code:
recordSet.Open("select * from Details"  +" where [User] ='" + user + "'",conn,1,3,adCmdText);
works
So i guess it was the CmdText that did it
What is that i have never used it before?
Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top