SHARE
TWEET

Index File

a guest Aug 4th, 2011 245 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. </head>
  6.  
  7. <body>
  8. <form method="post" >
  9.   <input name="companynumber" type="text" />
  10. <input type="submit"  value="Submit" /></form>
  11. <%
  12.  
  13. Dim companynumber
  14.  
  15. 'Getting information from submitted form
  16. companynumber = request.form("companynumber")
  17.  
  18. Dim objconn,objRS,strSQL
  19. Set objconn = Server.CreateObject("ADODB.Connection")
  20. objconn.ConnectionString = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("db.mdb")
  21. objconn.Open
  22.  
  23. Set objRs = Server.CreateObject("ADODB.Recordset")
  24. Set rs = Server.CreateObject("ADODB.Recordset")
  25. 'check if value blank
  26. if companynumber = "" then
  27.         response.write "Please enter your Company Number"
  28.     else
  29. SQLQuery = "SELECT ID FROM Company WHERE CompanyNumber = "&companynumber&" "
  30. rs.Open SQLQuery, objconn
  31. 'check if wrong value
  32.     if rs.BOF and rs.EOF then
  33.         response.write "incorrect company number , please try again"
  34.     else
  35.  
  36.  
  37. strSQL = "SELECT * FROM Project WHERE CompanyID = "&rs("ID")&""
  38.  
  39.  
  40. objRS.Open strSQL, objconn
  41.  
  42. Do While Not objRS.EOF
  43. response.write "<a href='login.asp?project=" & objRs("ID") & "'><b>" & objRs("ProjectName") & "</a><br>"
  44.  
  45.  
  46. objRS.MoveNext
  47. Loop
  48.  
  49. objRs.Close
  50. objconn.Close
  51. end if
  52.   end if%>
  53. </body>
  54. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top