request form error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • j0rdanf1
    New Member
    • Oct 2006
    • 35

    request form error

    Hi,

    I have been working on this for 2 days now, basically I need a front end to edit some data in oracle. Though everytime i pass the info between the pages i get


    Code:
    Band Name:
    
    ADODB.Field error '80020009'
    
    Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
    
    /user/edit_band.asp, line 0
    this is the code behind the page

    Code:
    <html>
    <head>
    <title>Update band details</title>
    <%
    
    Dim strSQL, objConn, objRs
    
    editband=request.form("editband")
    
    strSQL = "select * from Band where band_name='"&editband&"'"
    
    Set objConn = Server.CreateObject("ADODB.Connection")
    objConn.Open "dsn=Oracle;uid=user;pwd=password;"
    Set objRs = objConn.execute(strSQL)
    %>
    </head>
    <body>
     <form name="booking" method="post" action="updateband.asp" onSubmit="return validate(this);">
         <p>Band Name: <BR>
       
           <input type="text" name="band_name" maxlength="20" onChange="javascript:this.value=this.value.toLowerCase();"value="<% Response.Write objRS("band_name") %>">
           <br>
         Band Genre: <BR>
           <select name="band_genre" size="1">
    	   	 <option selected="indie"><% Response.Write objRS("genre")%></option>
             <option value="Rock">Rock</option>
             <option value="Metal">Metal</option>
             <option value="Pop">Pop</option>
             <option value="R n B">R n B</option>
             <option value="jazz">Jazz</option>
             <option value="Country">Country</option>
             <option value="Punk">Punk</option>
             <option value="Drum n Bass">Drum n Bass</option>
             <option value="Dance">Dance</option>
    		 <option value="Alternative">Alternative</option>
    		 <option value="Other">Other</option>
           </select>
           
         Band Location: <BR>
           <input type="text" name="band_location" maxlength="50"value="<% Response.Write objRS("location") %>">
         
         Band Biography 
         <br>
    <textarea name="band_bio" cols="40" rows="5"><% Response.Write objRS("band_bio") %></textarea>
    <BR>
         <input type="submit" name="Submit" value="Submit">
        
         <input name="Clear" type="reset" id="Clear" value="Reset">
     </form> 
     <%
    objRs.Close
    Set objRs=Nothing
    objConn.Close
    Set objConn=Nothing
    %>
    </body>
    </html>
    with not having much experience with this im stumped. any ideas?
  • jagged
    New Member
    • Feb 2008
    • 23

    #2
    It looks like request.form("e ditband") is empty, hence you are actually calling this query:

    select * from band where band_name = ''


    Unless you have records where band_name is an empty string, it would return an empty recordset and throw that error when you try to use it.


    You should do something like:

    Code:
    editband=request.form("editband")
    
    IF Len(editband) = 0 Then
    Response.Write "No band selected"
    Response.End
    End If
    If you see "No band selected" then your problem is on another page.

    By the way, you need to be careful about using user input in sql queries like that. Someone can easily do an sql injection attack. At least use editband = Replace(editban d, "'","''").. .

    Comment

    Working...