senadaulay
Programmer
Pleaseee help...thank's in advance.
I'm working on a simple search page that is supposed to search data, when user type a Employee ID in the
textBox (Form SearchUpdate.asp)
then the datas will show in the next form(ResultUpdate.asp).
my code are working Fine If the EmployeeID were correct and the datas are exists, but When I input EmployeeID which doesn't exists I got error message like this:
Error Type:
ADODB.Field (0x80020009)
Either BOF or EOF is True, or the current record has been deleted.
Requested operation requires a current record.
/Nur/Project1_ASP/ResultUpdate.asp
I want to make a choices when the user input EmployeeID which doesn't exsits it will be show Message box say that datas aren't exsits and the user can chose if they want to insert the EmployeeID as a new Datas in (AddEmp.asp) or they can just will return to searchUpdate.asp. Is that make any sense?
where did I need to add the coding? any kind of help appreciated.
here's my code
-----SearchUpdate.asp
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
<CENTER><H1>Search Employee Data </H1></CENTER>
</HEAD>
<BODY bgcolor=lightskyblue>
<FORM METHOD="post" ACTION="ResultUpdate.asp" name=form1>
<BR>
<CENTER>
<TABLE style="WIDTH: 426px; HEIGHT: 232px" cellSpacing=1 cellPadding=1 width=426 border=1>
<TBODY>
<BR>
<TR>
<TD bgcolor=snow><CENTER>
<P> </P>
<P>Input Employee ID: <INPUT name=EmpID></CENTER></P><center> <INPUT type=submit value=Submit name=B1 style="WIDTH: 72px; HEIGHT: 42px" size=18> <INPUT style="WIDTH: 67px; HEIGHT: 42px" type=reset size=33 value=CLEAR>
<INPUT type="button" value=MainPage OnClick="location.href='MainPage.asp'" style="WIDTH: 76px; HEIGHT: 42px" size=19 >
</FORM></CENTER>
<CENTER></CENTER></TD></TR></TBODY></TABLE></CENTER>
</BODY>
</HTML>
-----ResultUpdate.asp
<%
Dim intID, varSName, varAddress
Dim intPhoneHome, intPostalCode, varSalary
Dim strsql,Conn,strConnect,rsData
intID = Request.Form ("EmpID")
Set Conn = Server.CreateObject ("ADODB.CONNECTION")
Set rsData = Server.CreateObject ("ADODB.Recordset")
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\TblEmploy.mdb"
strsql = "Select * from Data Where EmployeeID ="&intID&""
rsData.Open strsql, Conn
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<CENTER><H1>Update Employee Data</H1></CENTER>
<BODY bgcolor="lightblue">
<FORM ACTION= "ConfirmUpdate.asp" METHOD=post Name=frmConfirm >
<CENTER>
<TABLE style="WIDTH: 402px; HEIGHT: 172px" cellSpacing=1 cellPadding=1 width=402 border=1>
<TR><TD bgcolor=linen><P>EmployeeID</P></TD>
<TD bgcolor=linen><INPUT type="text" name="EmpID" value="<%=rsData("EmployeeID")%>" ></TD></TR>
<TR><TD bgcolor=linen><P>EmployeeName</P></TD>
<TD bgcolor=linen><INPUT type="text" name="EmpName" value="<%=rsData("EmployeeName")%>" ></TD></TR>
<TR><TD bgcolor=linen>EmployeeAddress</TD>
<TD bgcolor=linen><INPUT type="text" name="EmpAddress" value="<%=rsData("EmployeeAddress")%>" ></TD></TR>
<TR><TD bgcolor=linen>EmployeePhoneHome</TD>
<TD bgcolor=linen><INPUT type="text" name="EmpPhone" value="<%=rsData("EmployeePhoneHome")%>" ></TD></TR>
<TR><TD bgcolor=linen>EmployeePostalCode</TD>
<TD bgcolor=linen><INPUT type="text" name="EmpPostal" value="<%=rsData("EmployeePostalCode")%>" > </TD></TR>
<TR><TD bgcolor=linen>EmployeeSalary</TD>
<TD bgcolor=linen><INPUT type="text" name="EmpSalary" value="<%=rsData("EmployeeSalary")%>" ></TD></TR>
</TABLE></P>
<P><CENTER><INPUT id=submit1 style="WIDTH: 85px; HEIGHT: 40px" type=Submit size=28 value=UPDATE name=update>
<INPUT type="button" value=CANCEL OnClick="location.href='MainPage.asp'" style="WIDTH: 88px; HEIGHT: 42px" size=22>
<INPUT type="button" value=BACK OnClick="location.href='SearchUpdate.asp'" style="WIDTH: 88px; HEIGHT: 42px" size=22></CENTER></P>
<P> </P>
</FORM>
</BODY>
</HTML>
-----ConfirmUpdate.asp
<%
Dim intID, varSName, varAddress
Dim intPhoneHome, intPostalCode, varSalary
Dim strsql,Conn,strConnect,rsData
Set Conn = Server.CreateObject ("ADODB.CONNECTION")
Set rsData = Server.CreateObject ("ADODB.Recordset")
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\TblEmploy.mdb"
intID = Request.Form ("EmpID")
varSName = Request.Form ("EmpName")
varAddress = Request.Form ("EmpAddress")
intPhoneHome = Request.Form ("EmpPhone")
intPostalCode = Request.Form ("EmpPostal")
varSalary = Request.Form ("EmpSalary")
strsql= "UPDATE Data " &_
"SET EmployeeName= '"&varSName&"',EmployeeAddress= '"&varAddress &"', " & _
"EmployeePhoneHome= "&intPhoneHome &",EmployeePostalCode= "&intPostalCode &",EmployeeSalary= '"&varSalary &"' " &_
"WHERE EmployeeID= "&intID &""
Conn.Execute strsql
Conn.Close
set Conn = nothing
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY bgcolor=mistyrose>
<CENTER><H1> CONFIRMATION PAGE </H1>
<P> </P></CENTER>
<CENTER><H2>Data Was Updated</H2>
<P> </P></CENTER>
<CENTER>
<INPUT type="button" value=MainPage OnClick="location.href='MainPage.asp'" style="WIDTH: 96px; HEIGHT: 42px" size=24>
<INPUT type="button" value="List Employee" OnClick="location.href='ListEmployee.asp'" style="WIDTH: 105px; HEIGHT: 42px" size=26>
<P>
</CENTER></P>
</BODY>
</HTML>
Can anyone help me?
Thank's
I'm working on a simple search page that is supposed to search data, when user type a Employee ID in the
textBox (Form SearchUpdate.asp)
then the datas will show in the next form(ResultUpdate.asp).
my code are working Fine If the EmployeeID were correct and the datas are exists, but When I input EmployeeID which doesn't exists I got error message like this:
Error Type:
ADODB.Field (0x80020009)
Either BOF or EOF is True, or the current record has been deleted.
Requested operation requires a current record.
/Nur/Project1_ASP/ResultUpdate.asp
I want to make a choices when the user input EmployeeID which doesn't exsits it will be show Message box say that datas aren't exsits and the user can chose if they want to insert the EmployeeID as a new Datas in (AddEmp.asp) or they can just will return to searchUpdate.asp. Is that make any sense?
where did I need to add the coding? any kind of help appreciated.
here's my code
-----SearchUpdate.asp
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
<CENTER><H1>Search Employee Data </H1></CENTER>
</HEAD>
<BODY bgcolor=lightskyblue>
<FORM METHOD="post" ACTION="ResultUpdate.asp" name=form1>
<BR>
<CENTER>
<TABLE style="WIDTH: 426px; HEIGHT: 232px" cellSpacing=1 cellPadding=1 width=426 border=1>
<TBODY>
<BR>
<TR>
<TD bgcolor=snow><CENTER>
<P> </P>
<P>Input Employee ID: <INPUT name=EmpID></CENTER></P><center> <INPUT type=submit value=Submit name=B1 style="WIDTH: 72px; HEIGHT: 42px" size=18> <INPUT style="WIDTH: 67px; HEIGHT: 42px" type=reset size=33 value=CLEAR>
<INPUT type="button" value=MainPage OnClick="location.href='MainPage.asp'" style="WIDTH: 76px; HEIGHT: 42px" size=19 >
</FORM></CENTER>
<CENTER></CENTER></TD></TR></TBODY></TABLE></CENTER>
</BODY>
</HTML>
-----ResultUpdate.asp
<%
Dim intID, varSName, varAddress
Dim intPhoneHome, intPostalCode, varSalary
Dim strsql,Conn,strConnect,rsData
intID = Request.Form ("EmpID")
Set Conn = Server.CreateObject ("ADODB.CONNECTION")
Set rsData = Server.CreateObject ("ADODB.Recordset")
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\TblEmploy.mdb"
strsql = "Select * from Data Where EmployeeID ="&intID&""
rsData.Open strsql, Conn
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<CENTER><H1>Update Employee Data</H1></CENTER>
<BODY bgcolor="lightblue">
<FORM ACTION= "ConfirmUpdate.asp" METHOD=post Name=frmConfirm >
<CENTER>
<TABLE style="WIDTH: 402px; HEIGHT: 172px" cellSpacing=1 cellPadding=1 width=402 border=1>
<TR><TD bgcolor=linen><P>EmployeeID</P></TD>
<TD bgcolor=linen><INPUT type="text" name="EmpID" value="<%=rsData("EmployeeID")%>" ></TD></TR>
<TR><TD bgcolor=linen><P>EmployeeName</P></TD>
<TD bgcolor=linen><INPUT type="text" name="EmpName" value="<%=rsData("EmployeeName")%>" ></TD></TR>
<TR><TD bgcolor=linen>EmployeeAddress</TD>
<TD bgcolor=linen><INPUT type="text" name="EmpAddress" value="<%=rsData("EmployeeAddress")%>" ></TD></TR>
<TR><TD bgcolor=linen>EmployeePhoneHome</TD>
<TD bgcolor=linen><INPUT type="text" name="EmpPhone" value="<%=rsData("EmployeePhoneHome")%>" ></TD></TR>
<TR><TD bgcolor=linen>EmployeePostalCode</TD>
<TD bgcolor=linen><INPUT type="text" name="EmpPostal" value="<%=rsData("EmployeePostalCode")%>" > </TD></TR>
<TR><TD bgcolor=linen>EmployeeSalary</TD>
<TD bgcolor=linen><INPUT type="text" name="EmpSalary" value="<%=rsData("EmployeeSalary")%>" ></TD></TR>
</TABLE></P>
<P><CENTER><INPUT id=submit1 style="WIDTH: 85px; HEIGHT: 40px" type=Submit size=28 value=UPDATE name=update>
<INPUT type="button" value=CANCEL OnClick="location.href='MainPage.asp'" style="WIDTH: 88px; HEIGHT: 42px" size=22>
<INPUT type="button" value=BACK OnClick="location.href='SearchUpdate.asp'" style="WIDTH: 88px; HEIGHT: 42px" size=22></CENTER></P>
<P> </P>
</FORM>
</BODY>
</HTML>
-----ConfirmUpdate.asp
<%
Dim intID, varSName, varAddress
Dim intPhoneHome, intPostalCode, varSalary
Dim strsql,Conn,strConnect,rsData
Set Conn = Server.CreateObject ("ADODB.CONNECTION")
Set rsData = Server.CreateObject ("ADODB.Recordset")
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\TblEmploy.mdb"
intID = Request.Form ("EmpID")
varSName = Request.Form ("EmpName")
varAddress = Request.Form ("EmpAddress")
intPhoneHome = Request.Form ("EmpPhone")
intPostalCode = Request.Form ("EmpPostal")
varSalary = Request.Form ("EmpSalary")
strsql= "UPDATE Data " &_
"SET EmployeeName= '"&varSName&"',EmployeeAddress= '"&varAddress &"', " & _
"EmployeePhoneHome= "&intPhoneHome &",EmployeePostalCode= "&intPostalCode &",EmployeeSalary= '"&varSalary &"' " &_
"WHERE EmployeeID= "&intID &""
Conn.Execute strsql
Conn.Close
set Conn = nothing
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY bgcolor=mistyrose>
<CENTER><H1> CONFIRMATION PAGE </H1>
<P> </P></CENTER>
<CENTER><H2>Data Was Updated</H2>
<P> </P></CENTER>
<CENTER>
<INPUT type="button" value=MainPage OnClick="location.href='MainPage.asp'" style="WIDTH: 96px; HEIGHT: 42px" size=24>
<INPUT type="button" value="List Employee" OnClick="location.href='ListEmployee.asp'" style="WIDTH: 105px; HEIGHT: 42px" size=26>
<P>
</CENTER></P>
</BODY>
</HTML>
Can anyone help me?
Thank's