Click to See Complete Forum and Search --> : Desperate for Helps


onime
12-08-2005, 02:08 AM
The Codes
<%
set rs=Server.CreateObject("adodb.recordset")
macType_sql="select Power From machines"
rs.Open
macType_sql,conn,3,3
do until rs.EOF
response.Write("<option value=")
response.Write(rs("Power"))
response.Write(">")
response.write(rs.fields("Power"))
rs.MoveNext
loop
rs.close

IF Request.form("Power") <> "0" THEN
Dim pwr
pwr = CDBL(Request.Form("Power"))
set rs=Server.CreateObject("adodb.recordset")
macType_sql = "select * From machines WHERE Power=" & pwr & ""
rs.Open macType_sql,conn,3,3

if (rs.BOF or rs.EOF) then
txtMacName = ""
txtMacSpd = ""

Else
txtMacName = rs("MachineName")
txtMacSpd = rs("Speed")
End if
End if

%>

</select>
&nbsp;
<input type="submit" name="Submit" value="Show">
</b></p>
<p align="center"><b>Machine Name: <input type="text" name="T1" value="<%= txtMacName%>" size="20"></b></p>
<p align="center"><b>Machine Speed : <input type="text" name="T2" value="<%= txtMacSpd%>" size="20"></b></p>

<%

IF Request.form("FeedRate") <> "0" THEN
Dim id
id = rs("txtMacSpd")
set rs=Server.CreateObject("adodb.recordset")
macType_sql = "select FeedRate From Feed WHERE MachineID=" & id & ""
rs.Open macType_sql,conn,3,3

if (rs.BOF or rs.EOF) then
FeedRate = ""
else
do until rs.EOF
response.Write("<option value=")
response.Write(rs("FeedRate"))
response.Write(">")
response.write(rs.fields("FeedRate"))
rs.MoveNext
loop
end if
Else

response.Write("<option value=")
response.Write(rs(""))
response.Write(">")
response.write(rs.fields(""))

rs.close
end if
%>

This is the Error
Error Type:
ADODB.Recordset (0x800A0CC1)
Item cannot be found in the collection corresponding to the requested name or ordinal.

my actual program
after the type of power is selected.
it will display the machine name and the machine speed

after the machine speed is displayed.
i need the feed rate to be displayed into another dropdown list.
and that's where the error occurs..

can someone PLEASE reply me back ASAP ?
need this code urgently..



P.S. please kindly leave a note if there's anything unclear.

Thankz

metalman3d
12-08-2005, 10:36 AM
in the code:

response.Write("<option value=")
response.Write(rs(""))
response.Write(">")
response.write(rs.fields(""))

you need to have a field in your database that matches what is in the quotes. You'll get that error if you misspell the name of the field in your asp as well.