SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Oct 2013
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    String value getting dropped.

    I found a nice Add/Update and Delete asp page...changed some of the code for my needs now I have having an issue with my STR value is getting dropped by the edit function. here is the code...



    Code:
    <!DOCTYPE html>
    <html dir="ltr" lang="en-US">
    
    <%
    	Dim Conn,strSQL,objExec,objRec,i,StrPO
    %>
    <%
     strPO = Request.Querystring("W") 
     %>
    
    <head>
    <!-- Created by Artisteer v4.1.0.59861 -->
    <meta charset="utf-8">
    <title>Home</title>
    <meta name="viewport" content="initial-scale = 1.0, maximum-scale = 1.0, user-scalable = no, width = device-width">
    <!--[if lt IE 9]>
    <script src="https://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <link rel="stylesheet" href="style.css" media="screen">
    <!--[if lte IE 7]>
    <link rel="stylesheet" href="style.ie7.css" media="screen" />
    <![endif]-->
    <link rel="stylesheet" href="style.responsive.css" media="all">
    <script src="jquery.js"></script>
    <script src="script.js"></script>
    <script src="script.responsive.js"></script>
    <meta name="description" content="Description">
    <meta name="keywords" content="Keywords">
    <style type="text/css">
    .style1 {
    	text-align: left;
    }
    </style>
    </head>
    
    <body style="background-color: #CCD2E0">
    
    <div id="art-main">
    	<div class="art-sheet clearfix" style="left: 0px; top: 0px; width: 1462px">
    <header class="art-header">
    
    
        	<div class="art-shapes">
    		</div>
           
    </header>
    
    <nav class="art-nav">
        	<ul class="art-hmenu">
    			<li><a href="Web/home.html" class="active">Home</a></li>
    			<li><a href="Web/contacts.html">Contacts</a></li>
    		</ul>
        </nav>
    		<div class="art-layout-wrapper">
    			<div class="art-content-layout">
    				<div class="art-content-layout-row">
    					<div class="art-layout-cell art-content">
    						<article class="art-post art-article">
                                    
                                                    
                    		<div class="art-postcontent art-postcontent-0 clearfix">
    							<table class="art-article" border="0" cellspacing="0" cellpadding="0" style="margin: 0; width: 100%; height: 50px;">
    								<html>
    
    								
    </style>
    								</head>
    
    								<body style="background-color: #CCD2E0">
    
    
    <body>
    <%
    strPO = Request.Querystring("W") 
    
    '' This line works as it is hard coded....
    
    'strSQL = "SELECT * FROM HW_Refresh WHERE rtrim(PO) ='potest'"
    
    ' This line doesn't work and this is what I need....
    
    strSQL = "SELECT * FROM HW_Refresh WHERE rtrim(PO) = '" & strPO & "'"
    
    ' Print of the Value
       Response.Write(Request.QueryString("w")& "<br>")
    
    ' Print of the SQL Statement
    
       Response.Write(Request.QueryString("strSQL ")& "<br>")
    	Set Conn = Server.Createobject("ADODB.Connection")
    	Conn.Open "Provider=SQLOLEDB;server=XXXXXXXX;Initial Catalog=XXXXX;User ID=XXXXXX_DBO;Password=XXXXXXXXX;"
    	Set objRec = Server.CreateObject("ADODB.Recordset")
    	objRec.Open strSQL, Conn, 1,3 
        Response.Write( STRSQL & "<br>")
    
    	'*** Update Condition ***'
    	If Request.Form("hdnCmd") = "Update" Then
    		strSQL = "UPDATE Hw_refresh SET "
    		strSQL = strSQL&"NewAs= '"&Request.Form("txtEditNewAs")&"' "
    		strSQL = strSQL&",UserName= '"&Request.Form("txtEditUserName")&"' "
    		strSQL = strSQL&",Site= '"&Request.Form("txtEditSite")&"' "
    		strSQL = strSQL&",NewML= '"&Request.Form("txtEditNewML")&"' "
    		strSQL = strSQL&",DateIssued = '"&Request.Form("txtEditDateIssued")&"' "
    		strSQL = strSQL&",Issuedto = '"&Request.Form("txtEditIssuedto")&"' "
    		strSQL = strSQL&",oldML = '"&Request.Form("txtEditOldML")&"' "
    		strSQL = strSQL&",OldAs = '"&Request.Form("txtEditOldAs")&"' "
    		strSQL = strSQL&"WHERE PO= '"&Request.Form("hdnEditPO")&"' "
    		Set objExec = Conn.Execute(strSQL)
    	End IF
    
    %>
    <form Name="frmMain" method="post" action="<%=Request.ServerVariables("SCRIPT_Name")%>">
    <input type="hidden" Name="hdnCmd" value="">
    <table border="1" style="width: 1155px">
      <tr>
        <th class="style3" style="width: 167px"> <div align="center" class="style4">New	Asset</div></th>
        <th class="style3" style="width: 167px"> <div align="center" class="style4">PO</div></th>
        <th class="style3" style="width: 167px"> <div align="center" class="style4">User Name</div></th>
        <th class="style3" style="width: 167px"> <div align="center" class="style4">Site</div></th>
        <th class="style3" style="width: 167px"> <div align="center" class="style4">New Model</div></th>
        <th class="style3" style="width: 167px"> <div align="center" class="style4">Date Issued</div></th>
        <th class="style3" style="width: 167px"> <div align="center" class="style4">Issued To </div></th>
        <th class="style3" style="width: 167px"> <div align="center" class="style4">Old Model</div></th>
        <th class="style3" style="width: 167px"> <div align="center" class="style4">Old Asset </div></th>
        <th class="style3" style="width: 167px"> <div align="center" class="style4">Edit </div></th>
      </tr>
    <%
    While Not objRec.EOF
    %>
    
      <%
    	IF objRec.Fields("PO").Value = Request.QueryString("CusID") and Request.QueryString("Action") = "Edit" Then
      %>
      <tr>
        <td style="width: 109px"><div align="center">
    	<input type="text"  Name="txtEditNewAs" size="5" value="<%=objRec.Fields("NewAs").Value%>" readonly="readonly" style="width: 114px">
    	<input type="hidden" Name="hdnEditNewAs" size="5" value="<%=objRec.Fields("Newas").Value%>"></div></td>
    	<td style="width: 109px"><div align="center">
         <input type="text"  Name="txtEditPO" size="5" value="<%=objRec.Fields("PO").Value%>" readonly="readonly" style="width: 114px">
    	    <td style="width: 109px"><div align="center">
    	<input type="text" Name="txtEditUserName" size="20" value="<%=objRec.Fields("UserName").Value%>" style="width: 114px"></div></td>
        <td style="width: 109px"><div align="center">
    	<input type="text" Name="txtEditSite" size="20" value="<%=objRec.Fields("Site").Value%>" style="width: 114px"></div></td>
        <td style="width: 109px"><div align="center">
    	<input type="text" Name="txtEditNewML" size="10" value="<%=objRec.Fields("NewML").Value%>" style="width: 114px"></div></td>
        <td style="width: 109px"><div align="center">
    	<input type="text" Name="txtEditDateIssued " size="10" value="<%=objRec.Fields("DateIssued").Value%>" style="width: 114px"></div></td>
        <td style="width: 109px"><div align="center">
    	<input type="text" Name="txtEditIssuedto" size="10" value="<%=objRec.Fields("issuedto").Value%>" style="width: 114px"></div></td>
        <td style="width: 109px"><div align="center">
    	<input type="text" Name="txtEditOldML" size="10" value="<%=objRec.Fields("OldML").Value%>" style="width: 114px"></div></td>
        <td style="width: 109px"><div align="center">
    	<input type="text" Name="txtEditOldAS" size="10" value="<%=objRec.Fields("OldAS").Value%>" style="width: 114px"></div></td>
        <td colspan="2" align="right"><div align="center">
          <input Name="btnAdd" type="button" id="btnUpdate" value="Update" OnClick="frmMain.hdnCmd.value='Update';frmMain.submit();">
    	  <input Name="btnAdd" type="button" id="btnCancel" value="Cancel" OnClick="window.location='<%=Request.ServerVariables("SCRIPT_Name")%>';">
        </div></td>
      </tr>
      <%
    	Else
      %>
      <tr>
        <td class="style1" style="width: 167px"><%=objRec.Fields("NewAs").Value%></td>
        <td class="style1" style="width: 167px"><%=objRec.Fields("PO").Value%></td>
        <td class="style1" style="width: 167px"><%=objRec.Fields("UserName").Value%></td>
        <td class="style1" style="width: 189px"><%=objRec.Fields("Site").Value%></td>
        <td class="style1" style="width: 167px"><%=objRec.Fields("NewML").Value%></td>
        <td class="style1" style="width: 167px"><%=objRec.Fields("DateIssued").Value%></td>
        <td class="style1" style="width: 167px"><%=objRec.Fields("Issuedto").Value%></td>
        <td class="style1" style="width: 167px"><%=objRec.Fields("OldML").Value%></td>
        <td class="style1" style="width: 167px"><%=objRec.Fields("OldAS").Value%></td>
        <td align="center"><a href="<%=Request.ServerVariables("SCRIPT_Name")%>?Action=Edit&CusID=<%=objRec.Fields("NewAs").Value%>">Edit</a></td>
      </tr>
      <%
    	End IF
      %>
    <%
    	objRec.MoveNext
    	Wend
    %>
      
    </table>
    </form>
    <%
    	objRec.Close()
    	Conn.Close()
    	Set objRec = Nothing
    	Set Conn = Nothing
    %>
    </body>
    </html>
    <!--- -->
    Last edited by TechnoBear; Oct 31, 2013 at 10:51. Reason: Code tags added

  2. #2
    Life is not a malfunction gold trophysilver trophybronze trophy
    TechnoBear's Avatar
    Join Date
    Jun 2011
    Location
    Argyll, Scotland
    Posts
    6,088
    Mentioned
    256 Post(s)
    Tagged
    5 Thread(s)
    Hi bobbykay and welcome to the forums.

    I don't know a thing about ASP, so I can't answer your specific question, but I've spotted a few superfluous tags which might well cause you problems at some stage:

    Code:
    </style>
    </head>
    
    <body style="background-color: #CCD2E0">
    
    <div id="art-main">
    	<div class="art-sheet clearfix" style="left: 0px; top: 0px; width: 1462px">
    <header class="art-header">
    
    
        	<div class="art-shapes">
    		</div>
           
    </header>
    
    <nav class="art-nav">
        	<ul class="art-hmenu">
    			<li><a href="Web/home.html" class="active">Home</a></li>
    			<li><a href="Web/contacts.html">Contacts</a></li>
    		</ul>
        </nav>
    		<div class="art-layout-wrapper">
    			<div class="art-content-layout">
    				<div class="art-content-layout-row">
    					<div class="art-layout-cell art-content">
    						<article class="art-post art-article">
                                    
                                                    
                    		<div class="art-postcontent art-postcontent-0 clearfix">
    							<table class="art-article" border="0" cellspacing="0" cellpadding="0" style="margin: 0; width: 100%; height: 50px;">
    								<html>Oops - what's that doing there?
    
    								
    </style>Closing tag for an element which isn't open (and doesn't belong in the body)
    								</head>Another closing tag for an element which isn't open (and doesn't belong in the body)
    
    								<body style="background-color: #CCD2E0">Second body opening tag
    
    
    <body>Third body opening tag
    Hope that helps.
    Take plenty of exercise walk round and round the garden
    or
    sign up now for the Isle of Jura 10K or Half Marathon!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •