Jump to content
Sign in to follow this  
tamakuwalapranav

ASP Error

Recommended Posts

Hi all, I have connect my ASP file with MS Access database and I have hips of records in my database.Actual senario:when I start my application, it will start with login page. Once I enter my username and password , it will check in database and it finds and record under that username and password, it will display that users personal information and few others information according to HTML designing page. But whats happening is that I can enter my username and password but after that page comes up with this erros msg:Error Type:ADODB.Field (0x80020009)Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.Now I want to know that how can I remove this error msg and where do put loop or any thing that could help me out to remove this error.My Coding: <%if session("txtusername")="" thenResponse.Redirect("default.asp")end if%><%if session("txtusername")="" thenResponse.Redirect("default.asp")end if%><%loginname= session("txtusername")username=request.form("username")password=session("txtpassword") Set con = Server.CreateObject("ADODB.Connection")con.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("Academic.mdb")Set rs1=server.CreateObject("ADODB.Recordset")sql1="select * from student where username='"&txtusername&"' and password='"&txtpassword&"'"rs1.open sql1,con, adCmdTable%><html><head><title>Student Enrolment Form</title><h4> <font color="#FFFFFF">Personal Information </font></h4><tr><td align="right"><font size="2"><b>Family Name (*)</b></font><td colspan="2"> <div align="left><font size="2"><input name="famname" onBlur= isAlpha(this) size="35" maxlength="20" value="<% = rs1("lastName") %>" ></font></div></td></tr><br><input type="submit" name="Submit" value="Update">   <input type="reset" value="Cancel"><br></br><centre> <b> <font color="05379A"> Note: (*) mendetory fields </font></b> </form></body></html><%rs1.CloseSet rs1 = NothingSet con = Nothing%>In above code, lastName is my database field.Cheers,PRANAV

Share this post


Link to post
Share on other sites

I'm assuming the error happens here:<input name="famname" onBlur= isAlpha(this) size="35" maxlength="20" value="<% = rs1("lastName") %>" >That error happens when the recordset does not contain any information. You can avoid it with a check for BOF or EOF

<%if not rs1.EOF and not rs1.BOF then  lname = rs1("lastName")else  lname = ""end if%><input name="famname" onBlur= isAlpha(this) size="35" maxlength="20" value="<% = lname %>" >

Someone else might need to check my syntax with VB, it might not be right.

Share this post


Link to post
Share on other sites
In above code, lastName is my database field.Cheers,PRANAV

What does the above quote mean? Do you have only lastname as database field? where does the username and password come from? In your error message, the error will point out to your filename and line number, where does it points to?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...