Select, Insert, Update, Delete Records in Database - Employee

File 1 : emp.asp
To select the employee ID

  1. span style="color: #cc0000;">"VBSCRIPT" CODEPAGE="65001""ADODB.Connection""ADODB.Command""ADODB.Command""Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\empdb.mdb;Persist Security Info=False""select * from emptable""-//W3C//DTD XHTML 1.0 Transitional//EN" "<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html</a> xmlns="<a href="http://www.w3.org/1999/xhtml">
  4. ">http://www.w3.org/1999/xhtml""Content-Type""text/html; charset=utf-8""frmemp""empdb.asp""post""empid""submit""btnsubmit" value="Display"

File 2 : empdb.asp
To display the information in html form to view, edit, add, delete

  1. span style="color: #cc0000;">"VBSCRIPT" CODEPAGE="65001""ADODB.Connection""ADODB.Command""ADODB.Command""Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\empdb.mdb;Persist Security Info=False""empid") = """emp.asp""-//W3C//DTD XHTML 1.0 Transitional//EN" "<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html</a> xmlns="<a href="http://www.w3.org/1999/xhtml">
  4. ">http://www.w3.org/1999/xhtml""Content-Type""text/html; charset=utf-8""vbscript""""""""""empid""select * from emptable where empid=""empdisp""post""empdbm.asp""text""empid" value="<% =rs.fields(0)%>" size="20""text""empname" value="<%=rs.fields(1)%>" size="20""text""empdept" value="<%=rs.fields(2)%>" size="20""text""empsalary" value="<%=rs.fields(3)%>" size="20""button""btnnew""new""submit""btnsave" value="update""submit""btnsave" value="save""submit""btnsave" value="delete""emp.asp"> Back </a>
  5. </body>
  6. </html>

File 3 : empdbm.asp
To process the insert, update, delete operations

  1. span style="color: #cc0000;">"VBSCRIPT" CODEPAGE="65001""ADODB.Connection""ADODB.Command""ADODB.Command""Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\empdb.mdb;Persist Security Info=False""btnsave") = """emp.asp""btnsave""empid""empname""empdept""empsalary""-//W3C//DTD XHTML 1.0 Transitional//EN" "<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html</a> xmlns="<a href="http://www.w3.org/1999/xhtml">
  4. ">http://www.w3.org/1999/xhtml""Content-Type""text/html; charset=utf-8""save""select * from emptable where empid=""ID Number already exists.. <br/> Please choose different roll number""INSERT INTO emptable VALUES (" &empids & ",'""','" &empdepts &"'," &empsalarys &")""Record Saved""edit""UPDATE emptable SET empname = '""', dept='" &empdepts &"', salary=" &empsalarys &" where empid = ""Record Updated""delete""delete * from emptable where empid = ""Record Deleted""emp.asp"> Back </a>
  5.  
  6.  
  7.  
  8.  
  9.  
  10. </body>
  11. </html>

File 4 : empdb.mdb
Create MS Access database file with the following information and place it in D:\empdb.mdb
Columns

Empid - Long Integer(4) - Primary Key
Empname - Tex(255)
Dept - Text(255)
Salary - Long Integer(4)