Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 26th, 2005, 12:58 AM
Friend of Wrox
 
Join Date: May 2005
Posts: 201
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to hastikeyvan
Default viewing different tables accornig to form

i wrote a program that gets that gets 26 parameters and according to the form enetery but it doesn't work
my program is as below:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>

<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers="3,2,1"
MM_authFailedURL="login.asp"
MM_grantAccess=false
If Session("MM_Username") <> "" Then
  If (false Or CStr(Session("MM_UserAuthorization"))="") Or _
         (InStr(1,MM_authorizedUsers,Session("MM_UserAuthor ization"))>=1) Then
    MM_grantAccess = true
  End If
End If
If Not MM_grantAccess Then
  MM_qsChar = "?"
  If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
  MM_referrer = Request.ServerVariables("URL")
  if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
  MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
  Response.Redirect(MM_authFailedURL)
End If
%>
<%
Dim rs
Dim rs_numRows
Dim rs_MMColParam
  MMColParam = Request.Form("SiteWorkshop")



Dim rs_MMColParam1
MMColParam1 = Request.Form("UnitNo")




Dim rs_MMColParam2
MMColParam2 = Request.Form("HGNo")


Dim rs_MMColparam3
MMColParam3 = Request.Form("HGResponsible")


Dim rs_myarray4


  myarray4 = Request.Form("Supplier")

Dim rs_myarray5


  myarray5 = Request.Form("ScopeOfWork")


Dim rs_myarray6

  myarray6 = Request.Form("YesNo")

Dim rs_myarray7

  myarray7 = Request.Form("BaseLineDeliveryDateToIran")


Dim rs_myarray8

  myarray8 = Request.Form("Location")

Dim rs_myarray9

  myarray9 = Request.Form("ActualDeliveryDateToIranCustom")

Dim rs_myarray10


  myarray10 = Request.Form("CustomsClearance")

Dim rs_myarray11


  myarray11 = Request.Form("Contract")

Dim rs_myarray12


  myarray12 = Request.Form("EarliestNeeded")

Dim rs_myarray13


  myarray13 = Request.Form("LatestNeeded")

Dim rsmyarray14


  myarray14 = Request.Form("ManufactureStart")

Dim rs_myarray15


 myarray15 = Request.Form("Duration")

Dim rs_myarray16


  myarray16 = Request.Form("ManufactureEnd")

Dim rs_myarray17


  myarray17 = Request.Form("ActualProgress")

Dim rs_myarray18


  myarray18 = Request.Form("PlannedProgress")

Dim rs_myarray19


  myarray19 = Request.Form("Variance")

Dim rs_myarray20


  myarray20 = Request.Form("Delay")

Dim rs_myarray21


  myarray21 = Request.Form("LocationOfHG")

Dim rs_myarray22


  myarray22 = Request.Form("Remark")

Dim rs_myarray23


  myarray23 = Request.Form("Released")

Dim rs_myarray24


  myarray24 = Request.Form("SiemenseReleaseNote")

Dim rs_myarray25


  myarray25 = Request.Form("SGSFinalApproval")
Dim myarry(23),index
myarry = array("myarray3","myarray4","myarray5","myarray6", "myarray7","myarray8","myarray9","myarray10","myar ray11","myarray12","myarray13","myarray14","myarra y15","myarray16","myarray17","myarray18","myarray1 9","myarray20","myarray21","myarray22","myarray23" ,"myarray24","myarray25")
%>
<%
Set rs = Server.CreateObject("ADODB.Recordset")
rs.ActiveConnection = MM_QCcon_STRING
rs.Source = "SELECT * FROM dbo.tbHGInf WHERE SiteWorkshop = '%" + Replace(rs__MMColParam, "'", "''") + "%' AND UnitNo = '%" + Replace(rs__MMColParam1, "'", "''") + "%' AND HGNo = '%" + Replace(rs__MMColParam2, "'", "''") + "%'"
rs.CursorType = 0
rs.CursorLocation = 2
rs.LockType = 1
rs.Open()

rs_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
rs_numRows = rs_numRows + Repeat1__numRows
%>



<%
Dim MM_paramName
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters

Dim MM_keepNone
Dim MM_keepURL
Dim MM_keepForm
Dim MM_keepBoth

Dim MM_removeList
Dim MM_item
Dim MM_nextItem

' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "") Then
  MM_removeList = MM_removeList & "&" & MM_paramName & "="
End If

MM_keepURL=""
MM_keepForm=""
MM_keepBoth=""
MM_keepNone=""

' add the URL parameters to the MM_keepURL string
For Each MM_item In Request.QueryString
  MM_nextItem = "&" & MM_item & "="
  If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
    MM_keepURL = MM_keepURL & MM_nextItem & Server.URLencode(Request.QueryString(MM_item))
  End If
Next

' add the Form variables to the MM_keepForm string
For Each MM_item In Request.Form
  MM_nextItem = "&" & MM_item & "="
  If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
    MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request.Form(MM_item))
  End If
Next

' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
If (MM_keepBoth <> "") Then
  MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
End If
If (MM_keepURL <> "") Then
  MM_keepURL = Right(MM_keepURL, Len(MM_keepURL) - 1)
End If
If (MM_keepForm <> "") Then
  MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
End If

' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
  If (firstItem <> "") Then
    MM_joinChar = "&"
  Else
    MM_joinChar = ""
  End If
End Function
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>HG Information View</title>
<style type="text/css">
<!--
body,td,th {
    color: #000033;
}
body {
    background-color: #fdfeff;
    background-image: url(back.jpg);
}
.style1 {
    font-size: x-large;
    font-style: italic;
    font-weight: bold;
}
.style2 {
    color: #FFFFFF;
    font-style: italic;
    font-weight: bold;
}
-->
</style>

</head>

<body><table width="709" border="0" align="center">
  <tr>
    <td width="768" background="OTC.jpg"><table width="709" border="0" align="center">
      <tr>
        <td width="751" align="left"><img src="ban2.jpg" width="709" height="179">
          <table width="709" border="0" align="left" cellpadding="0" cellspacing="0">
            <tr>
              <td width="420"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="420" height="30">
                <param name="movie" value="link40.swf">
                <param name="quality" value="high">
                <embed src="link40.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="420" height="30"></embed>
              </object></td>
              <td width="279" align="left"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="140" height="30">
                <param name="movie" value="link13.swf">
                <param name="quality" value="high">
                <embed src="link13.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="140" height="30"></embed>
              </object></td>
            </tr>
          </table></td>
      </tr>
      <tr>
        <td><span class="style1"><br>
            <img src="icon_folder_new_topic.gif" width="15" height="15">HG Information </span></td>
      </tr>
      <tr>
        <td><table border="0" align="center">
          <tr align="center" bgcolor="#000033">
            <td><span class="style2">Row</span></td>
            <td><span class="style2">Site /Workshop </span></td>
            <td><span class="style2">UnitNo</span></td>
            <td><span class="style2">HGNo</span></td>
            <td><span class="style2">HGName</span></td>
            <%Dim i,s
                i = 0
             While i < 23
              if myarry(i) = "1" then
               select Case i
               Case "0"
                       s="HG Responsible"
               case "1"
                       s="Supplier"
               Case "2"
                       s="ScopeOfWork"
               Case "3"
                       s="Yes / No"
                Case"4"
                    s="BaseLine Delivery Date To Iran"
                Case "5"
                    s="Location"
                Case "6"
                    s="Actual Delivery Date To Iran Custom"
                Case "7"
                    s="Customs Clearance"
                Case "8"
                    s="Contract"
                Case "9"
                    s="Earliest Needed"
                Case "10"
                    s="Latest Needed"
                Case "11"
                    s="Start"
                Case "12"
                    s="Duration"
                Case "13"
                    s="End"
                Case "14"
                    s="Actual Progress"
                Case "15"
                    s="Planned Progress(Baseline)"
                Case "16"
                    s="Variance(Planned & Actual)"
                Case "17"
                    s="Delay"
                Case "18"
                    s="Location Of HG"
                Case "19"
                    s="Remark"
                Case "20"
                    s="Released"
                Case "21"
                    s="Siemense Release Note"
                Case "22"
                    s="SGS Final Approval"
                  End Select
               %>
             <td><% Response.Write(s)%></td>
            <%
            i = i + 1
            end if
            wend%>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <%
While ((Repeat1__numRows <> 0) AND (NOT rs.EOF))
%>
          <tr align="center">
              <td><%=(rs.Fields.Item("Row").Value)%></td>
              <td><%=(rs.Fields.Item("SiteWorkshop").Value)%></td>
              <td><%=(rs.Fields.Item("UnitNo").Value)%></td>
              <td><%=(rs.Fields.Item("HGNo").Value)%></td>
              <td><%=(rs.Fields.Item("HGName").Value)%></td>
             <%Dim s1
              i = 0
             While i< 23
              if myarry(i)= "1" then
                select Case i
               Case "0"
                       s1="HGResponsible"
               case "1"
                       s1="Supplier"
               Case "2"
                       s1="ScopeOfWork"
               Case "3"
                       s1="YesNo"
                Case"4"
                    s1="BaseLineDeliveryDateToIran"
                Case "5"
                    s1="Location"
                Case "6"
                    s1="ActualDeliveryDateToIranCustom"
                Case "7"
                    s1="CustomsClearance"
                Case "8"
                    s1="Contract"
                Case "9"
                    s1="EarliestNeeded"
                Case "10"
                    s1="LatestNeeded"
                Case "11"
                    s1="ManufactureStart"
                Case "12"
                    s1="Duration"
                Case "13"
                    s1="ManufactureEnd"
                Case "14"
                    s1="ActualProgress"
                Case "15"
                    s1="PlannedProgress"
                Case "16"
                    s1="Variance"
                Case "17"
                    s1="Delay"
                Case "18"
                    s1="LocationOfHG"
                Case "19"
                    s1="Remark"
                Case "20"
                    s1="Released"
                Case "21"
                    s1="SiemenseReleaseNote"
                Case "22"
                    s1="SGSFinalApproval"
                  End Select%>
              <td><%rs.Fields.Item(s1).value%> </td>
              <% end if
                  wend%>
              <td><em><A HREF="HGinfupdate.asp?<%= Server.HTMLEncode(MM_keepURL) & MM_joinChar(MM_keepURL) & "Row=" & rs.Fields.Item("Row").Value %>">Update</A></em></td>
              <td><em><A HREF="HGinfdelete.asp?<%= Server.HTMLEncode(MM_keepURL) & MM_joinChar(MM_keepURL) & "Row=" & rs.Fields.Item("Row").Value %>">Delete</A></em></td>
          </tr>
          <tr>
              <td colspan="8"></td>
          </tr>
          <%
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  rs.MoveNext()
Wend
%>

        </table></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
    </table></td>
  </tr>
</table>


</body>
</html>
<%
rs.Close()
Set rs = Nothing
%>
please hepl me to fix it



 
Old June 26th, 2005, 06:20 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

;;;but it doesn't work -- please hepl me to fix it

you will get more assistance from forums if you have:
a..run the code
b..posted the error including line number
c..describe what you are trying to achieve
And if possible:
d..indicated where you think the problematic area is
c..post just the problematic code.




Wind is your friend
Matt
 
Old June 26th, 2005, 11:54 PM
Friend of Wrox
 
Join Date: May 2005
Posts: 201
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to hastikeyvan
Default

 none of lines has error just timout error occure and the page opens so slowly and after that i,ve got and error that it takes much time and the page could not be shown.
i want to have different tables if each variable value is "1" .

 
Old June 27th, 2005, 12:20 AM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

What I would do:
Strip the code back and run the page (no errors).
Write more code, run it...continue this process until you reach the problematic area then post the problematic code.
Try to follow what I have suggested above. You have posted this problem twice, I saw it last time. I am not suprized you didnt get assisted. This place is not where you come to get pages re-written. If people see you have done what you can to achieve your objective, they will help. Are you using MM Dream weaver?



Wind is your friend
Matt
 
Old June 27th, 2005, 01:48 AM
Friend of Wrox
 
Join Date: May 2005
Posts: 201
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to hastikeyvan
Default

i use MM Dreamweaver.i,ve changed my program and now it shows different tables but although i put some places to show the value of each record it doesn't show anything, just a desired table title without any value below.i've checked my bindings they were right.the probmalatic code is as below:
While ((Repeat1__numRows <> 0) AND (NOT rs.EOF))
%>
          <tr align="center">
              <td><%=(rs.Fields.Item("Row").Value)%></td>
              <td><%=(rs.Fields.Item("SiteWorkshop").Value)%></td>
              <td><%=(rs.Fields.Item("UnitNo").Value)%></td>
              <td><%=(rs.Fields.Item("HGNo").Value)%></td>
              <td><%=(rs.Fields.Item("HGName").Value)%></td>
             <% if formvar1="1" then
            %>
            <td><%=(rs.Fields.Item("HGResponsible").Value)%> </td>
            <%end if%>
            <% if formvar2="1" then
            %>
            <td><%=(rs.Fields.Item("Supplier").Value)%></td>
            <%end if%>

            <% if formvar3="1" then
            %>
            <td><%=(rs.Fields.Item("ScopeOfWork").Value)%></td>
            <%end if%>
            <% if formvar4="1" then
            %>
            <td><%=(rs.Fields.Item("YesNo").Value)%></td>
            <%end if%>

            <% if formvar5="1" then
            %>
            <td><%=(rs.Fields.Item("BaseLineDeliveryDateToIran ").Value)%></td>
            <%end if%>

            <% if formvar6="1" then
            %>
            <td><%=(rs.Fields.Item("Location").Value)%></td>
            <%end if%>
            <% if formvar7="1" then
            %>
            <td><%=(rs.Fields.Item("ActualDeliveryDateToIranCu stom").Value)%></td>
            <%end if%>

            <% if formvar8="1" then
            %>
            <td><%=(rs.Fields.Item("CustomsClearance").Value)% ></td>
            <%end if%>
            <% if formvar9="1" then
            %>
            <td><%=(rs.Fields.Item("Contract").Value)%></td>
            <%end if%>
            <% if formvar10="1" then
            %>
            <td><%=(rs.Fields.Item("EarliestNeeded").Value)% ></td>
            <%end if%>


            <% if formvar11="1" then
            %>
            <td><%=(rs.Fields.Item("LatestNeeded").Value)%></td>
            <%end if%>

            <% if formvar12="1" then
            %>
            <td><%=(rs.Fields.Item("ManufactureStart").Value)% ></td>
            <%end if%>

            <% if formvar13="1" then
            %>
            <td><%=(rs.Fields.Item("Duration").Value)%></td>
            <%end if%>

            <% if formvar14="1" then
            %>
            <td><%=(rs.Fields.Item("ManufactureEnd").Value)% ></td>
            <%end if%>

            <% if formvar15="1" then
            %>
            <td><%=(rs.Fields.Item("ActualProgress").Value)% ></td>
            <%end if%>
            <% if formvar16="1" then
            %>
            <td><%=(rs.Fields.Item("PlannedProgress").Value)%> </td>
            <%end if%>

            <% if formvar17="1" then
            %>
            <td><%=(rs.Fields.Item("Variance").Value)%></td>
            <%end if%>

            <% if formvar18="1" then
            %>
            <td><%=(rs.Fields.Item("Delay").Value)%></td>
            <%end if%>

            <% if formvar19="1" then
            %>
            <td><%=(rs.Fields.Item("LocationOfHG").Value)%></td>
            <%end if%>

            <% if formvar20="1" then
            %>
            <td><%=(rs.Fields.Item("Remark").Value)%></td>
            <%end if%>

            <% if formvar21="1" then
            %>
            <td><%=(rs.Fields.Item("Released").Value)%></td>
            <%end if%>

            <% if formvar22="1" then
            %>
            <td><%=(rs.Fields.Item("SiemenseReleaseNote").Valu e)%></td>
            <%end if%>

            <% if formvar23="1" then
            %>
            <td><%=(rs.Fields.Item("SGSFinalApproval").Value)% ></td>
            <%end if%>

            <% if formvar24="1" then
            %>
            <td><%=(rs.Fields.Item("SiteName").Value)%></td>
            <%end if%>





Similar Threads
Thread Thread Starter Forum Replies Last Post
insert data in two tables from form mfarooqw ASP.NET 1.0 and 1.1 Professional 1 July 10th, 2007 08:34 AM
2 tables, 1 query, 1 form, cannot edit :( tanjuakio Access 2 June 24th, 2005 06:24 AM
Updating Two Tables from Form Input PamS Access 6 October 30th, 2003 02:46 PM
Viewing Calculated Totals In A Form WillRockwell BOOK: Beginning Access VBA 3 October 23rd, 2003 09:18 AM
Updating Multiple Tables with 1 Dreamweaver Form stephaniejones Dreamweaver (all versions) 0 July 9th, 2003 09:58 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.