Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

144 lines
3.6 KiB

  1. <html>
  2. <!--
  3. update bug in RAID
  4. QueryString : none
  5. Form : bugid=bug# | CREATE
  6. desc : text to be added at end of existing description
  7. field names as present in bugs RAID table
  8. -->
  9. <head>
  10. </head>
  11. <body>
  12. <!--#include virtual="/aspsamp/samples/adovbs.inc"-->
  13. <%
  14. dim all()
  15. ReDim all(Request.Form.Count)
  16. AddDesc = null
  17. BugID =""
  18. mx = 0
  19. for each nm in Request.Form
  20. if nm = "bugid" then
  21. BugID = Request.Form(nm)
  22. elseif nm = "action" then
  23. elseif nm = "desc" then
  24. AddDesc = Request.Form(nm) & chr(13) & chr(10)
  25. else
  26. all(mx) = nm
  27. mx = mx + 1
  28. end if
  29. next
  30. Set Conn = Server.CreateObject("ADODB.Connection")
  31. Conn.CommandTimeout = 90
  32. Conn.Open Session("DSN")
  33. Set RS = Server.CreateObject("ADODB.Recordset")
  34. Set Comm = Server.CreateObject("ADODB.Command")
  35. Set Comm.ActiveConnection = Conn
  36. Comm.CommandText = "Select DBColName,FriendlyName,XPos,YPos,Width,Height,HelpText,Type,fForcedEntry from flds"
  37. Set RS.Source = Comm
  38. RS.Open
  39. FldArray = RS.GetRows()
  40. RS.Close
  41. if BugID = "CREATE" then
  42. RS.CursorType = adOpenStatic
  43. Set RS.Source = Comm
  44. Conn.BeginTrans
  45. Comm.CommandText = "Select IsNull(max(BugID)+1,1) from bugs"
  46. RS.Open
  47. bid = RS(0)
  48. RS.Close
  49. v = "INSERT INTO bugs(BugID,Description"
  50. for i = 0 to mx - 1
  51. v = v & "," & all(i)
  52. next
  53. v = v + ") VALUES (" & bid & ",'" & AddDesc & "'"
  54. for i = 0 to mx - 1
  55. typ = 0
  56. for j = 0 to UBound(FldArray,2)
  57. if FldArray(0,j) = all(i) then
  58. typ = FldArray(7,j)
  59. exit for
  60. end if
  61. next
  62. rem if type us numeric then do not use ''
  63. if typ = 2 then
  64. v = v & "," & Request.Form(all(i))
  65. else
  66. v = v & ",'" & Request.Form(all(i)) & "'"
  67. end if
  68. next
  69. v = v + ")"
  70. rem Response.Write v
  71. Conn.Execute v
  72. Conn.CommitTrans
  73. ElseIf BugID <> "" then
  74. Set uRS = Server.CreateObject("ADODB.Recordset")
  75. uRS.ActiveConnection = Conn
  76. base = 0
  77. do while mx
  78. if ( mx > 12 ) then
  79. n = 12
  80. else
  81. n = mx
  82. end if
  83. fl = ""
  84. for i = 0 to n - 1
  85. if i > 0 then
  86. fl = fl & ","
  87. end if
  88. fl = fl & all(base+i)
  89. next
  90. uRS.Source = "Select " & fl & " from bugs where BugID=" & BugID
  91. uRS.CursorType = adOpenStatic
  92. uRS.LockType = adLockOptimistic
  93. uRS.Open
  94. for i = 0 to n - 1
  95. rem Response.Write all(base+i) &"," & Request.Form(all(base+i)) & "-"
  96. uRS(all(base+i)).Value = Request.Form(all(base+i))
  97. next
  98. uRS.Update
  99. uRS.Close
  100. base = base + n
  101. mx = mx - n
  102. loop
  103. if vbNull <> VarType(AddDesc) then
  104. uRS.Source = "Select Description from bugs where BugID=" & BugID
  105. uRS.CursorType = adOpenStatic
  106. uRS.LockType = adLockOptimistic
  107. uRS.Open
  108. rem Response.Write uRS(0) & AddDesc
  109. uRS("Description").Value = uRS(0) & AddDesc
  110. uRS.Update
  111. uRS.Close
  112. end if
  113. end if
  114. Conn.Close
  115. %>
  116. <script FOR=window EVENT=onload() language="JavaScript">
  117. // this will be executed only if execution was successful
  118. window.close();
  119. </script>
  120. </body>
  121. </html>