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!

Database parameters error 2

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
 
recordSet.Open("select * from Details" +" where User =" + user + "",conn,adOpenKeyset,adLockOptimistic, [red]adCmdText[/red]);

-DNG
 
Thanks for the reply
But the still gives me the same error
 
try this:
Code:
recordSet.Open "select * from Details where [User] ='"& user& "' ", conn, adOpenKeyset, adLockOptimistic, adCmdText;

-DNG
 
now i get
Code:
Error Type:
Microsoft JScript compilation (0x800A03EC)
Expected ';'
/Trod/Report.asp, line 14, column 15
recordSet.Open "select * from Details where [User] ='"& user& "' ",conn,adOpenKeyset,adLockOptimistic,adCmdText;
--------------^
 
You're dealing with script code here...so you can't use the enumeration names for the CursorType, LockType, and CommandType...you must use their associated integer values.
 
it should be all in one line...if you are putting it in separate lines then...try this:

Code:
recordSet.Open " select * from Details where "&_
               " [User] ='"& user& "' ", conn,"&_
               " adOpenKeyset, adLockOptimistic, adCmdText;"

-DNG
 
recordSet.Open("select * from Details" +" where [User] ='" + user + "'",conn,1,3,1);
 
Thanks
i used
Code:
recordSet.Open("select * from Details"  +" where [User] ='" + user + "'",conn,1,3,adCmdText);
And it works!!
Thanks fr all you help
 
oh i dint see that you were using JScript...you need + instead of &

-DNG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top