Home > ASP Development > Help..can't solve this problem

Help..can't solve this problem



<i><b>Originally posted by : kaarthik (kaarthik@singnet.com.sg)</b></i><br />Hi<br />I have this error which I can't solve. Could anybody please help me. ok here it goes<br />I have two tables 1) states 2)angel<br />the states table has all the states of the world<br />the angel table contains information pertaining to the states table. the asp page which I have is supposed to fill a pulldown box with the states table. Then with the requested string I have to search the angel table which contains the state..then its supposed to show the angel table records which contains the state. But I get an error like this<br />Microsoft OLE DB Provider for ODBC Drivers error '80040e10' <br /><br />[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1. <br /><br />/dbshow.asp, line 24 <br /><br />Please help<br />the code is shown here <br /><br /><br /><%<br />Dim objDC, objRS<br /><br />' Create and establish data connection<br />Set objDC = Server.CreateObject("ADODB.Connection")<br /><br /><br />'Use this line to use Access<br />objDC.Open "DSN=new"<br /><br />'Our SQL Server code - use above line to use sample on your server<br />'objDC.Open Application("SQLConnString"), Application("SQLUsername"), Application("SQLPassword")<br /><br /><br />' Create recordset and retrieve values using the open connection<br />Set objRS = Server.CreateObject("ADODB.Recordset")<br />' Opening record set with a forward-only cursor (the 0) and in read-only mode (the 1)<br /><br />' If a request for a specific id comes in, then do it o/w just show pulldown<br />If Len(Request.QueryString("State")) <> 0 Then<br /> ' request record for requested state<br /> objRS.Open "SELECT * FROM Angel WHERE Departure=" & Request.QueryString("State"), objDC, 0, 1<br /> ' Show selected record<br /> If Not objRS.EOF Then<br /> objRS.MoveFirst<br /> %><br /> <TABLE BORDER=2><br /> <TR><br /> <TD><B>Departure</B></TD><br /> <TD><B>Vessel</B></TD><br /> <TD><B>Voyage No.</B></TD><br /> <TD><B>Operator</B></TD><br /> <TD><B>Arrival</B></TD><br /> </TR><br /> <TR><br /> <TD ALIGN="center"><%= objRS.Fields("Departure") %></TD><br /> <TD ALIGN="center"><%= objRS.Fields("Vessel") %></TD><br /> <TD ALIGN="center"><%= objRS.Fields("Voyage") %></TD><br /> <TD ALIGN="center"><%= objRS.Fields("Operator") %></TD><br /> <TD ALIGN="center"><%= objRS.Fields("Arrival") %></TD><br /> </TR><br /> </TABLE><br /> <%<br /> End If<br /> objRS.Close<br />End If<br /><br />objRS.Open "SELECT * FROM States", objDC, 0, 1<br />' Loop through recordset and display results<br />If Not objRS.EOF Then<br /> objRS.MoveFirst<br /> ' the form below calls this file only this time with an id in the QueryString<br /> %><br /> <FORM ACTION="./dbshow.asp" METHOD="get"><br /> <SELECT NAME="State"><br /> <OPTION></OPTION><br /> <%<br /> ' Continue until we get to the end of the recordset.<br /> Do While Not objRS.EOF<br /> ' For each record we create a option tag and set it's value to the employee id<br /> ' The text we set to the employees first name combined with a space and then their last name<br /> %><br /> <OPTION VALUE="<%=objRS.Fields("State") %>"><%=objRS.Fields("State")%></OPTION><br /> <%<br /> ' Get next record<br /> objRS.MoveNext<br /> Loop<br /> %><br /> </SELECT><br /> <INPUT type="submit" value="Submit"><br /> </FORM><br /> <%<br />End If<br /><br />' Close Data Access Objects and free DB variables<br />objRS.Close<br />Set objRS = Nothing<br />objDC.Close<br />Set objDC = Nothing<br />%><br />

    
Guest


<i><b>Originally posted by : Eric Isaacs (eisaacs@costco.com)</b></i><br />I can't see your db, but I imagine that the state data is text, not numeric. If this is the case, change your SQL to the following...<br /><br />objRS.Open "SELECT * FROM Angel WHERE Departure=""" & Trim(Request.QueryString("State")) & """", objDC, 0, 1<br /><br />This will insert double quotes around the state value. If it is numeric data, then the quotes are not required.<br /><br />Eric Isaaacs<br /><br />------------<br />kaarthik at 2/7/00 4:31:24 AM<br /><br />Hi<br />I have this error which I can't solve. Could anybody please help me. ok here it goes<br />I have two tables 1) states 2)angel<br />the states table has all the states of the world<br />the angel table contains information pertaining to the states table. the asp page which I have is supposed to fill a pulldown box with the states table. Then with the requested string I have to search the angel table which contains the state..then its supposed to show the angel table records which contains the state. But I get an error like this<br />Microsoft OLE DB Provider for ODBC Drivers error '80040e10' <br /><br />[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1. <br /><br />/dbshow.asp, line 24 <br /><br />Please help<br />the code is shown here <br /><br /><br /><%<br />Dim objDC, objRS<br /><br />' Create and establish data connection<br />Set objDC = Server.CreateObject("ADODB.Connection")<br /><br /><br />'Use this line to use Access<br />objDC.Open "DSN=new"<br /><br />'Our SQL Server code - use above line to use sample on your server<br />'objDC.Open Application("SQLConnString"), Application("SQLUsername"), Application("SQLPassword")<br /><br /><br />' Create recordset and retrieve values using the open connection<br />Set objRS = Server.CreateObject("ADODB.Recordset")<br />' Opening record set with a forward-only cursor (the 0) and in read-only mode (the 1)<br /><br />' If a request for a specific id comes in, then do it o/w just show pulldown<br />If Len(Request.QueryString("State")) <> 0 Then<br /> ' request record for requested state<br /> objRS.Open "SELECT * FROM Angel WHERE Departure=" & Request.QueryString("State"), objDC, 0, 1<br /> ' Show selected record<br /> If Not objRS.EOF Then<br /> objRS.MoveFirst<br /> %><br /> <TABLE BORDER=2><br /> <TR><br /> <TD><B>Departure</B></TD><br /> <TD><B>Vessel</B></TD><br /> <TD><B>Voyage No.</B></TD><br /> <TD><B>Operator</B></TD><br /> <TD><B>Arrival</B></TD><br /> </TR><br /> <TR><br /> <TD ALIGN="center"><%= objRS.Fields("Departure") %></TD><br /> <TD ALIGN="center"><%= objRS.Fields("Vessel") %></TD><br /> <TD ALIGN="center"><%= objRS.Fields("Voyage") %></TD><br /> <TD ALIGN="center"><%= objRS.Fields("Operator") %></TD><br /> <TD ALIGN="center"><%= objRS.Fields("Arrival") %></TD><br /> </TR><br /> </TABLE><br /> <%<br /> End If<br /> objRS.Close<br />End If<br /><br />objRS.Open "SELECT * FROM States", objDC, 0, 1<br />' Loop through recordset and display results<br />If Not objRS.EOF Then<br /> objRS.MoveFirst<br /> ' the form below calls this file only this time with an id in the QueryString<br /> %><br /> <FORM ACTION="./dbshow.asp" METHOD="get"><br /> <SELECT NAME="State"><br /> <OPTION></OPTION><br /> <%<br /> ' Continue until we get to the end of the recordset.<br /> Do While Not objRS.EOF<br /> ' For each record we create a option tag and set it's value to the employee id<br /> ' The text we set to the employees first name combined with a space and then their last name<br /> %><br /> <OPTION VALUE="<%=objRS.Fields("State") %>"><%=objRS.Fields("State")%></OPTION><br /> <%<br /> ' Get next record<br /> objRS.MoveNext<br /> Loop<br /> %><br /> </SELECT><br /> <INPUT type="submit" value="Submit"><br /> </FORM><br /> <%<br />End If<br /><br />' Close Data Access Objects and free DB variables<br />objRS.Close<br />Set objRS = Nothing<br />objDC.Close<br />Set objDC = Nothing<br />%><br />

Was this answer helpful ? Yes No   
Guest
 
 
Home - About Infoqu - Contact - Privacy Statement - Link to Infoqu - Bookmark Infoqu

Copyright 2007-2008 by Infoqu. All rights reserved