a webmaster learning community
     Home    Register     Search      Help      Login    
FrontPage Alternative
Sponsors

Hosting from $3.99 per month!

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions. dd

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

include leading zero in update query

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> include leading zero in update query
Page: [1]
 
adam2804

 

Posts: 34
Joined: 6/6/2006
Status: offline

 
include leading zero in update query - 6/21/2006 5:13:50   
Hello all,

I am currently using an update query to update fields on a database, but want to include the leading zero for the 'BillUsing' field, at the moment figures such as 01 are written to the database as 1. Does anyone know how to easily avoid this happening?

Thanks

<%
fp_sQry="UPDATE TB_MasterPrices SET   Unit = ::Unit::,   Price = ::Price::,   Billing_ID = ::Billing_ID::,   BillUsing = (""BillUsing"") WHERE   ID = '::ID::' AND   WorkType = '::WorkType::'"
fp_sDefault="Unit=&Price=&Billing_ID=&ID=&WorkType="
fp_sNoRecords="Pricing details updated."
fp_sDataConn="BureauManagerSQL"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&"
fp_iDisplayCols=16
fp_fCustomQuery=True
BOTID=15
fp_iRegion=BOTID
%>
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: include leading zero in update query - 6/21/2006 9:09:50   
quote:

BillUsing = (""BillUsing"")


How come you're not using the DRW syntax like this:

BillUsing = '::BillUsing::'

Is there some reason for that we should be aware of ? Right now you're just sending hard-coded data.

Is it a text field? (In the DB that is.)

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to adam2804)
adam2804

 

Posts: 34
Joined: 6/6/2006
Status: offline

 
RE: include leading zero in update query - 6/21/2006 9:16:05   
Sorry, my mistake about that, yes in the DRW the input is BillUsing = ::BillUsing::

The field itself is a dropdown box that returns an 'ID' which needs to update the 'BillUsing' field.

<select NAME="BillUsing" SIZE="1">
			<option><- Select Bill Using -></option>
			<!--webbot bot="AspInclude" clientside u-incfile="../../_fpclass/fpdbrgn1.inc" startspan --><!--#include file="../../_fpclass/fpdbrgn1.inc"--><!--webbot bot="AspInclude" endspan i-checksum="64934" -->
			<option VALUE="<%=FP_FieldHTML(fp_rs,"ID")%>"><%=FP_FieldHTML(fp_rs,"Description")%>
			</option>
			<!--webbot bot="AspInclude" clientside u-incfile="../../_fpclass/fpdbrgn2.inc" startspan --><!--#include file="../../_fpclass/fpdbrgn2.inc"--><!--webbot bot="AspInclude" endspan i-checksum="64936" -->
			</select>


The field is varchar(2)

Any ideas?

(in reply to rdouglass)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: include leading zero in update query - 6/21/2006 9:21:12   
quote:

dropdown box that returns an 'ID' which


Is that dropdown's 'value=' parameters being fed from a numerical field in a DB?

Lastly, can you put this code in the DRW somewhere before the last include line temporarily and post the SQL it returns?

<%Response.write(fp_sQry)
Response.end%>

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to adam2804)
adam2804

 

Posts: 34
Joined: 6/6/2006
Status: offline

 
RE: include leading zero in update query - 6/21/2006 9:31:54   
The drop down feeds from a VarChar field in the DB,

I'm not quite sure how I post back the results that you're asking for, where abouts do I have to post this? Thee FrontPage controls don't allow me to modify anything, or should I just post to a temporary file?

:)

(in reply to rdouglass)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: include leading zero in update query - 6/21/2006 9:51:33   
quote:

put this code in the DRW somewhere before the last include line


That should read "the last include line of the DRW."

You would put those two lines before the line that looks like this:

<!--#include file="../../_fpclass/fpdbrgn2.inc"-->

and that should write the full SQL code you're sending to the browser. Then you can copy and paste it here.

That help?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to adam2804)
adam2804

 

Posts: 34
Joined: 6/6/2006
Status: offline

 
RE: include leading zero in update query - 6/21/2006 10:07:00   
The page automatically redirects to a new page after the user submits the results.

I can't seem to see where the SQL prints out the results?

Sorry for being a bit thick, but i'm trying to pick up the ins and outs of Front Page as quickly as I can!

Thanks,

Adam

(in reply to rdouglass)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: include leading zero in update query - 6/21/2006 10:19:25   
quote:

<%Response.write(fp_sQry)
Response.end%>


And you put that code in the DRW before that include line, saved it, and then browsed to that page? If so, then you're not running the DRW at all for some reason.

The line:

response.end

should stop everything at that point and the SQL should be written to the screen just before that. If it does not, then for some reason we're not getting to the DRW.

Do you have a URL we could look at? If not, can you post the full page code?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to adam2804)
adam2804

 

Posts: 34
Joined: 6/6/2006
Status: offline

 
RE: include leading zero in update query - 6/21/2006 10:26:32   
Sorry, I didn't get any code come up before the page was loaded, here's the full code for the page:

<!--#include file="../../groupsecurity.inc"-->
<html>

<head>
	<meta http-equiv="Content-Language" content="en-gb">
	<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
	<meta name="ProgId" content="FrontPage.Editor.Document">
	<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
	<title>Modify Price Customer</title>    
    
    <meta name="Microsoft Theme" content="khaosintranet 1010, default">
<meta name="Microsoft Border" content="tlb, default">
</head>

<%
	Testing = 0

  	NTLogin = Request.ServerVariables("AUTH_USER")
	Access = 0
	URL = Split(Request.ServerVariables("URL"), "/")
	Page = URL(UBound(URL))

	set cn=server.CreateObject("ADODB.Connection")
	cn.Open "DSN=BureauManagerSQL", "FrontPage", "s0lution"         
   	set rs=server.CreateObject("ADODB.Recordset") 
%>


<body topmargin="0" leftmargin="0">

<p><b>
  <!--webbot bot="Navigation" S-Orientation="horizontal" S-Rendering="html" S-Bar="Slashes" S-Btn-Nml="<A HREF="#URL#" TARGET="#TARGET#" STYLE="{text-decoration: none;}">#LABEL#</A>" S-Btn-Sel="#LABEL#" S-Btn-Sep="&nbsp;/&nbsp;" S-Type="parent" B-Include-Home="FALSE" B-Include-Up="FALSE" -->
</b></p>

<% If AccessAllowed=0 Then %>
	<p> <font color="#FF0000"> <b>!! You do not have access to this page: <%= Page %> !!</b></font></p>
<%	Else %>

 <% If Request("Action") = "Delete1" Then %>

	<!--webbot bot="DatabaseRegionStart" s-columnnames s-columntypes s-dataconnection="BureauManagerSQL" b-tableformat="FALSE" b-menuformat="FALSE" s-menuchoice s-menuvalue b-tableborder="TRUE" b-tableexpand="TRUE" b-tableheader="TRUE" b-listlabels="FALSE" b-listseparator="FALSE" i-listformat="0" b-makeform="FALSE" s-recordsource s-displaycolumns s-criteria s-order s-sql="DELETE TB_MasterPrices<br>WHERE<br>  ID = '::ID::' AND<br>  WorkType = '::WorkType::'" b-procedure="FALSE" clientside suggestedext="asp" s-defaultfields="ID=&amp;WorkType=" s-norecordsfound="Pricing details deleted." i-maxrecords="256" i-groupsize="0" botid="14" u-dblib="../../_fpclass/fpdblib.inc" u-dbrgn1="../../_fpclass/fpdbrgn1.inc" u-dbrgn2="../../_fpclass/fpdbrgn2.inc" tag="BODY" preview="<table border=0 width="100%"><tr><td bgcolor="#FFFF00"><font color="#000000">This is the start of a Database Results region.</font></td></tr></table>" startspan b-WasTableFormat="FALSE" --><!--#include file="../../_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="DELETE TB_MasterPrices WHERE   ID = '::ID::' AND   WorkType = '::WorkType::'"
fp_sDefault="ID=&WorkType="
fp_sNoRecords="Pricing details deleted."
fp_sDataConn="BureauManagerSQL"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&"
fp_iDisplayCols=16
fp_fCustomQuery=True
BOTID=14
fp_iRegion=BOTID
%>
<!--#include file="../../_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="45936" --><!--webbot bot="DatabaseRegionEnd" b-tableformat="FALSE" b-menuformat="FALSE" u-dbrgn2="../../_fpclass/fpdbrgn2.inc" i-groupsize="0" clientside tag="BODY" preview="<table border=0 width="100%"><tr><td bgcolor="#FFFF00"><font color="#000000">This is the end of a Database Results region.</font></td></tr></table>" startspan --><!--#include file="../../_fpclass/fpdbrgn2.inc"-->
<!--webbot bot="DatabaseRegionEnd" endspan i-checksum="65064" -->   

<% 
If Request("Auto") = 1 Then

	strSQL = "DELETE TB_MasterPrices "
	strSQL = strSQL & " WHERE WorkType = '" & Request("WorkType") & "'"
	strSQL = strSQL & " AND ID IN (SELECT JobNumber FROM Jobs WHERE CustomerID = '" & Request("ID") & "' AND ISNULL(Delivered, 0) = 0)"
	
	If Testing=1 Then		
		response.write "<b>SQL = </b>" & strSQL & "<br>"
	End If
		
	cn.Execute strSQL

	strSQL = "DELETE TB_MasterPrices "
	strSQL = strSQL & " WHERE WorkType = '" & Request("WorkType") & "'"
	strSQL = strSQL & " AND ID IN (SELECT RegularJobNumber FROM RegularJobs WHERE CustomerID = '" & Request("ID") & "' AND Active = 1)"
	
	If Testing=1 Then		
		response.write "<b>SQL = </b>" & strSQL & "<br>"
	End If
		
	cn.Execute strSQL

End If
%>

<% 
If Request("Return") <> "" And Testing=0 Then
	ReturnArray = Split(Request("Return"), "?") 
	
	For i = 1 to UBound(ReturnArray )
		
		Return = Return & ReturnArray(i)
			
		If i = 1 Then
			Return = Return & "?"
		Else
			Return = Return & "&"
		End If
		
	Next

	Response.Redirect Return

End If 
%>



<% ElseIf Request("Action") = "Update" Then %>

	<!--webbot bot="DatabaseRegionStart" s-columnnames s-columntypes s-dataconnection="BureauManagerSQL" b-tableformat="FALSE" b-menuformat="FALSE" s-menuchoice s-menuvalue b-tableborder="TRUE" b-tableexpand="TRUE" b-tableheader="TRUE" b-listlabels="FALSE" b-listseparator="FALSE" i-listformat="0" b-makeform="FALSE" s-recordsource s-displaycolumns s-criteria s-order s-sql="UPDATE TB_MasterPrices SET<br>  Unit = ::Unit::,<br>  Price = ::Price::,<br>  Billing_ID = ::Billing_ID::<br>WHERE<br>  ID = '::ID::' AND<br>  WorkType = '::WorkType::'" b-procedure="FALSE" clientside suggestedext="asp" s-defaultfields="Unit=&amp;Price=&amp;Billing_ID=&amp;ID=&amp;WorkType=" s-norecordsfound="Pricing details updated." i-maxrecords="256" i-groupsize="0" botid="15" u-dblib="../../_fpclass/fpdblib.inc" u-dbrgn1="../../_fpclass/fpdbrgn1.inc" u-dbrgn2="../../_fpclass/fpdbrgn2.inc" tag="BODY" preview="<table border=0 width="100%"><tr><td bgcolor="#FFFF00"><font color="#000000">This is the start of a Database Results region.</font></td></tr></table>" startspan b-WasTableFormat="FALSE" b-UseDotNET="FALSE" CurrentExt sa-InputTypes b-DataGridFormat="FALSE" b-DGridAlternate="TRUE" sa-CritTypes --><!--#include file="../../_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="UPDATE TB_MasterPrices SET   Unit = ::Unit::,   Price = ::Price::,   Billing_ID = ::Billing_ID:: WHERE   ID = '::ID::' AND   WorkType = '::WorkType::'"
fp_sDefault="Unit=&Price=&Billing_ID=&ID=&WorkType="
fp_sNoRecords="Pricing details updated."
fp_sDataConn="BureauManagerSQL"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&"
fp_iDisplayCols=16
fp_fCustomQuery=True
BOTID=15
fp_iRegion=BOTID
%>
<!--#include file="../../_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="14475" -->
<%Response.write(fp_sQry) 
Response.end%>
<!--webbot bot="DatabaseRegionEnd" b-tableformat="FALSE" b-menuformat="FALSE" u-dbrgn2="../../_fpclass/fpdbrgn2.inc" i-groupsize="0" clientside tag="BODY" preview="<table border=0 width="100%"><tr><td bgcolor="#FFFF00"><font color="#000000">This is the end of a Database Results region.</font></td></tr></table>" startspan --><!--#include file="../../_fpclass/fpdbrgn2.inc"-->
<!--webbot bot="DatabaseRegionEnd" endspan i-checksum="65064" -->   


<% 
If Request("AutoRegular") = 1 Then

	strSQL = "UPDATE TB_MasterPrices SET"
	strSQL = strSQL & " Unit = " & Request("Unit")
	strSQL = strSQL & ", Price = " & Request("Price")
	strSQL = strSQL & ", Billing_ID = " & Request("Billing_ID")
	strSQL = strSQL & " WHERE WorkType = '" & Request("WorkType") & "'"
	strSQL = strSQL & " AND ID IN (SELECT JobNumber FROM Jobs WHERE CustomerID = '" & Request("ID") & "' AND ISNULL(Delivered, 0) = 0 AND RegularJobNo IS NOT NULL)"
	
	If Testing=1 Then		
		response.write "<b>SQL = </b>" & strSQL & "<br>"
	End If
		
	cn.Execute strSQL

	strSQL = "UPDATE TB_MasterPrices SET"
	strSQL = strSQL & " Unit = " & Request("Unit")
	strSQL = strSQL & ", Price = " & Request("Price")
	strSQL = strSQL & ", Billing_ID = " & Request("Billing_ID")
	strSQL = strSQL & " WHERE WorkType = '" & Request("WorkType") & "'"
	strSQL = strSQL & " AND ID IN (SELECT RegularJobNumber FROM RegularJobs WHERE CustomerID = '" & Request("ID") & "' AND Active = 1)"
	
	If Testing=1 Then		
		response.write "<b>SQL = </b>" & strSQL & "<br>"
	End If
		
	cn.Execute strSQL

	strSQL = "INSERT INTO TB_MasterPrices (ID, WorkType, Unit, Price, Billing_ID, PriceType_ID)"
	strSQL = strSQL & " SELECT JobNumber,  '" & Request("WorkType") & "', " & Request("Unit") & ", " & Request("Price") & ", " & Request("Billing_ID") & ", 2"
	strSQL = strSQL & " FROM Jobs WHERE CustomerID = '" & Request("ID") & "' AND ISNULL(Delivered, 0) = 0 AND RegularJobNo IS NOT NULL AND JobNumber NOT IN"
	strSQL = strSQL & " (SELECT p.ID FROM TB_MasterPrices p INNER JOIN Jobs r ON p.ID=r.JobNumber"
	strSQL = strSQL & " WHERE r.CustomerID = '" & Request("ID") & "' AND p.WorkType = '" & Request("WorkType") & "' AND p.PriceType_ID=3)"
	
	If Testing=1 Then		
		response.write "<b>SQL = </b>" & strSQL & "<br>"
	End If
		
	cn.Execute strSQL

	strSQL = "INSERT INTO TB_MasterPrices (ID, WorkType, Unit, Price, Billing_ID, PriceType_ID)"
	strSQL = strSQL & " SELECT RegularJobNumber,  '" & Request("WorkType") & "', " & Request("Unit") & ", " & Request("Price") & ", " & Request("Billing_ID") & ", 2"
	strSQL = strSQL & " FROM RegularJobs WHERE CustomerID = '" & Request("ID") & "' AND Active = 1 AND RegularJobNumber NOT IN"
	strSQL = strSQL & " (SELECT p.ID FROM TB_MasterPrices p INNER JOIN RegularJobs r ON p.ID=r.RegularJobNumber"
	strSQL = strSQL & " WHERE r.CustomerID = '" & Request("ID") & "' AND p.WorkType = '" & Request("WorkType") & "' AND p.PriceType_ID=2)"
	
	If Testing=1 Then		
		response.write "<b>SQL = </b>" & strSQL & "<br>"
	End If
		
	cn.Execute strSQL

End If
%>

<% 
If Request("AutoSpot") = 1 Then

	strSQL = "UPDATE TB_MasterPrices SET"
	strSQL = strSQL & " Unit = " & Request("Unit")
	strSQL = strSQL & ", Price = " & Request("Price")
	strSQL = strSQL & ", Billing_ID = " & Request("Billing_ID")
	strSQL = strSQL & " WHERE WorkType = '" & Request("WorkType") & "'"
	strSQL = strSQL & " AND ID IN (SELECT JobNumber FROM Jobs WHERE CustomerID = '" & Request("ID") & "' AND ISNULL(Delivered, 0) = 0 AND RegularJobNo IS NULL)"
	
	If Testing=1 Then		
		response.write "<b>SQL = </b>" & strSQL & "<br>"
	End If
		
	cn.Execute strSQL

	strSQL = "INSERT INTO TB_MasterPrices (ID, WorkType, Unit, Price, Billing_ID, PriceType_ID)"
	strSQL = strSQL & " SELECT JobNumber,  '" & Request("WorkType") & "', " & Request("Unit") & ", " & Request("Price") & ", " & Request("Billing_ID") & ", 2"
	strSQL = strSQL & " FROM Jobs WHERE CustomerID = '" & Request("ID") & "' AND ISNULL(Delivered, 0) = 0 AND RegularJobNo IS NULL AND JobNumber NOT IN"
	strSQL = strSQL & " (SELECT p.ID FROM TB_MasterPrices p INNER JOIN Jobs r ON p.ID=r.JobNumber"
	strSQL = strSQL & " WHERE r.CustomerID = '" & Request("ID") & "' AND p.WorkType = '" & Request("WorkType") & "' AND p.PriceType_ID=3)"
	
	If Testing=1 Then		
		response.write "<b>SQL = </b>" & strSQL & "<br>"
	End If
		
	cn.Execute strSQL

End If
%>

<% 
If Request("Return") <> "" And Testing=0 Then
	ReturnArray = Split(Request("Return"), "?") 
	
	For i = 1 to UBound(ReturnArray )
		
		Return = Return & ReturnArray(i)
			
		If i = 1 Then
			Return = Return & "?"
		Else
			Return = Return & "&"
		End If
		
	Next

	Response.Redirect Return

End If 
%>

<% Else %>

<!--webbot bot="DatabaseRegionStart" s-columnnames="CustomerID,CompanyName,WorkType,Billing_ID,Unit,Price,Description" s-columntypes="200,200,200,3,3,5,200" s-dataconnection="BureauManagerSQL" b-tableformat="FALSE" b-menuformat="FALSE" s-menuchoice="CustomerID" s-menuvalue="CustomerID" b-tableborder="TRUE" b-tableexpand="TRUE" b-tableheader="TRUE" b-listlabels="FALSE" b-listseparator="FALSE" i-listformat="0" b-makeform="FALSE" s-recordsource s-displaycolumns="CustomerID,CompanyName,WorkType,Billing_ID,Unit,Price,Description" s-criteria s-order s-sql="SELECT<br>  p.ID AS CustomerID,<br>  c.CompanyName,<br>  p.WorkType,<br>  b.ID AS Billing_ID,<br>  p.Unit,<br>  p.Price,<br>  w.Description<br>FROM<br>  TB_MasterPrices p INNER JOIN<br>  WorkType w ON p.WorkType=w.WorkType INNER JOIN<br>  Customers c ON p.ID=c.CUstomerID LEFT OUTER JOIN<br>  TB_Billing b ON p.Billing_ID=b.ID<br>WHERE<br>  p.ID = '::ID::' AND<br>  p.WorkType = '::WorkType::'" b-procedure="FALSE" clientside suggestedext="asp" s-defaultfields="ID=&amp;WorkType=" s-norecordsfound="No Price Details found" i-maxrecords="256" i-groupsize="0" botid="5" u-dblib="../../_fpclass/fpdblib.inc" u-dbrgn1="../../_fpclass/fpdbrgn1.inc" u-dbrgn2="../../_fpclass/fpdbrgn2.inc" tag="BODY" preview="<table border=0 width="100%"><tr><td bgcolor="#FFFF00"><font color="#000000">This is the start of a Database Results region.</font></td></tr></table>" startspan b-UseDotNET="FALSE" CurrentExt sa-InputTypes b-DataGridFormat="FALSE" b-DGridAlternate="TRUE" sa-CritTypes b-WasTableFormat="FALSE" b-ReplaceDatabaseRegion="FALSE" --><!--#include file="../../_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT   p.ID AS CustomerID,   c.CompanyName,   p.WorkType,   b.ID AS Billing_ID,   p.Unit,   p.Price,   w.Description FROM   TB_MasterPrices p INNER JOIN   WorkType w ON p.WorkType=w.WorkType INNER JOIN   Customers c ON p.ID=c.CUstomerID LEFT OUTER JOIN   TB_Billing b ON p.Billing_ID=b.ID WHERE   p.ID = '::ID::' AND   p.WorkType = '::WorkType::'"
fp_sDefault="ID=&WorkType="
fp_sNoRecords="No Price Details found"
fp_sDataConn="BureauManagerSQL"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=False
fp_sMenuChoice="CustomerID"
fp_sMenuValue="CustomerID"
fp_sColTypes="&CustomerID=200&CompanyName=200&WorkType=200&Billing_ID=3&Unit=3&Price=5&Description=200&"
fp_iDisplayCols=7
fp_fCustomQuery=True
BOTID=5
fp_iRegion=BOTID
%>
<!--#include file="../../_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="62835" -->   

<%
  CustomerID = FP_FieldVal(fp_rs,"CustomerID")
  CompanyName = FP_FieldVal(fp_rs,"CompanyName")
  WorkType = FP_FieldVal(fp_rs,"WorkType")
  Description = FP_FieldVal(fp_rs,"Description")
  
  If Len(Request("Unit"))=0 Then
	  Unit = FP_FieldVal(fp_rs,"Unit")
  Else
	  Unit = Request("Unit")
  End If
  
  If Len(Request("Price"))=0 Then
	  Price = FP_FieldVal(fp_rs,"Price")
  Else
	  Price = Request("Price")
  End If

  If Len(Request("Billing_ID"))=0 Then
	  Billing_ID = FP_FieldVal(fp_rs,"Billing_ID")
  Else
	  Billing_ID = Request("Billing_ID")
  End If
%>

<!--webbot bot="DatabaseRegionEnd" b-tableformat="FALSE" b-menuformat="FALSE" u-dbrgn2="../../_fpclass/fpdbrgn2.inc" i-groupsize="0" clientside tag="BODY" preview="<table border=0 width="100%"><tr><td bgcolor="#FFFF00"><font color="#000000">This is the end of a Database Results region.</font></td></tr></table>" startspan --><!--#include file="../../_fpclass/fpdbrgn2.inc"-->
<!--webbot bot="DatabaseRegionEnd" endspan i-checksum="65064" --> <form method="POST" name="FrontPage_Form1" action="price_modify_customer.asp" onsubmit="return FrontPage_Form1_Validator(this)" language="JavaScript">
	<table border="0" id="table1" cellspacing="5" cellpadding="0">
		<tr>
      <td bgcolor="#C0C0C0" style="text-align: right"><b>Customer ID:</b></td>
      <td>
      <% =CustomerID %></td>
    	</tr>
		<tr>
      <td bgcolor="#C0C0C0" style="text-align: right"><b>Company Name:</b></td>
      <td>
      <input type="hidden" name="ID" value="<% =CustomerID %>"><% =CompanyName %></td>
    	</tr>
		<tr>
      <td bgcolor="#C0C0C0" style="text-align: right"><b>Work Type:</b></td>
      <td>
      <input type="hidden" name="WorkType" value="<% =WorkType %>"><% =WorkType %></td>
    	</tr>
		<tr>
      <td bgcolor="#C0C0C0" style="text-align: right"><b>Description:</b></td>
      <td>
		<% =Description %></td>

    	</tr>
        <tr>
			<td bgcolor="#C0C0C0" style="text-align: right"><b>Billing:</b></td>
			<td>
			<nobr>
            <!--webbot bot="DatabaseRegionStart" s-columnnames="ID,Description" s-columntypes="3,200" s-dataconnection="BureauManagerSQL" b-tableformat="FALSE" b-menuformat="TRUE" s-menuchoice="Description" s-menuvalue="ID" b-tableborder="TRUE" b-tableexpand="TRUE" b-tableheader="TRUE" b-listlabels="TRUE" b-listseparator="TRUE" i-listformat="0" b-makeform="TRUE" s-recordsource s-displaycolumns="ID,Description" s-criteria s-order s-sql="SELECT <br> ID,<br>  Description<br>FROM<br>  TB_Billing<br>ORDER BY<br>  ID" b-procedure="FALSE" clientside suggestedext="asp" s-defaultfields s-norecordsfound="No records returned." i-maxrecords="256" i-groupsize="0" botid="16" u-dblib="../../_fpclass/fpdblib.inc" u-dbrgn1="../../_fpclass/fpdbrgn1.inc" u-dbrgn2="../../_fpclass/fpdbrgn2.inc" preview=" <span style="color: rgb(0,0,0); background-color: rgb(255,255,0)">Database</span> " startspan b-InForm="TRUE" b-WasTableFormat="FALSE" --><!--#include file="../../_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT   ID,   Description FROM   TB_Billing ORDER BY   ID"
fp_sDefault=""
fp_sNoRecords="No records returned."
fp_sDataConn="BureauManagerSQL"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=True
fp_sMenuChoice="Description"
fp_sMenuValue="ID"
fp_sColTypes="&ID=3&Description=200&"
fp_iDisplayCols=2
fp_fCustomQuery=True
BOTID=16
fp_iRegion=BOTID
%>
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="43361" --><select NAME="Billing_ID" SIZE="1">
            <option value="0"><- Select Billing Type -></option>
            <!--webbot bot="AspInclude" clientside u-incfile="../../_fpclass/fpdbrgn1.inc" startspan --><!--#include file="../../_fpclass/fpdbrgn1.inc"--><!--webbot bot="AspInclude" endspan i-checksum="64934" -->
            <option VALUE="<%=FP_FieldHTML(fp_rs,"ID")%>"
      <%
      if Billing_ID = FP_FieldHTML(fp_rs,"ID") then
        response.write " selected"
     end if
      %>
      >
            <%=FP_FieldHTML(fp_rs,"Description")%></option>
            <!--webbot bot="AspInclude" clientside u-incfile="../../_fpclass/fpdbrgn2.inc" startspan --><!--#include file="../../_fpclass/fpdbrgn2.inc"--><!--webbot bot="AspInclude" endspan i-checksum="64936" -->
            </select><!--webbot bot="DatabaseRegionEnd" b-tableformat="FALSE" b-menuformat="TRUE" u-dbrgn2="../../_fpclass/fpdbrgn2.inc" i-groupsize="0" clientside preview=" <span style="color: rgb(0,0,0); background-color: rgb(255,255,0)">Results</span> " startspan --><!--webbot bot="DatabaseRegionEnd" endspan --></nobr></td>
		</tr>
        <tr>
			<td bgcolor="#C0C0C0" style="text-align: right"><b>Bill Using:</b></td>
			<td>
			<nobr>
			<!--webbot bot="DatabaseRegionStart" s-columnnames="ID,Description" s-columntypes="200,200" s-dataconnection="BureauManagerSQL" b-tableformat="FALSE" b-menuformat="TRUE" s-menuchoice="Description" s-menuvalue="ID" b-tableborder="TRUE" b-tableexpand="TRUE" b-tableheader="TRUE" b-listlabels="TRUE" b-listseparator="TRUE" i-listformat="0" b-makeform="FALSE" s-recordsource s-displaycolumns="ID,Description" s-criteria s-order s-sql="SELECT     T.WorkType AS ID, T.WorkType + ' - ' + T.Description AS Description<br>FROM         Customers C INNER JOIN<br>                      TB_MasterPrices P ON C.CustomerID = P.ID INNER JOIN<br>                      WorkType T ON P.WorkType = T.WorkType INNER JOIN<br>                      TB_Billing b ON P.Billing_ID = b.ID INNER JOIN<br>                      TB_PriceType l ON P.PriceType_ID = l.ID<br>WHERE     (C.CustomerID LIKE '::ID::') AND (T.WorkType LIKE P.WorkType)<br>ORDER BY T.WorkType" b-procedure="FALSE" clientside suggestedext="asp" s-defaultfields="ID=" s-norecordsfound="No records returned." i-maxrecords="256" i-groupsize="0" botid="17" u-dblib="../../_fpclass/fpdblib.inc" u-dbrgn1="../../_fpclass/fpdbrgn1.inc" u-dbrgn2="../../_fpclass/fpdbrgn2.inc" preview=" <span style="color: rgb(0,0,0); background-color: rgb(255,255,0)">Database</span> " startspan b-InForm="TRUE" b-UseDotNET="FALSE" CurrentExt sa-InputTypes b-DataGridFormat="FALSE" b-DGridAlternate="TRUE" sa-CritTypes b-WasTableFormat="FALSE" --><!--#include file="../../_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT     T.WorkType AS ID, T.WorkType + ' - ' + T.Description AS Description FROM         Customers C INNER JOIN                       TB_MasterPrices P ON C.CustomerID = P.ID INNER JOIN                       WorkType T ON P.WorkType = T.WorkType INNER JOIN                       TB_Billing b ON P.Billing_ID = b.ID INNER JOIN                       TB_PriceType l ON P.PriceType_ID = l.ID WHERE     (C.CustomerID LIKE '::ID::') AND (T.WorkType LIKE P.WorkType) ORDER BY T.WorkType"
fp_sDefault="ID="
fp_sNoRecords="No records returned."
fp_sDataConn="BureauManagerSQL"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=True
fp_sMenuChoice="Description"
fp_sMenuValue="ID"
fp_sColTypes="&ID=200&Description=200&"
fp_iDisplayCols=2
fp_fCustomQuery=True
BOTID=17
fp_iRegion=BOTID
%>
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="45068" --><select NAME="BillUsing" SIZE="1">
			<option><- Select Bill Using -></option>
			<!--webbot bot="AspInclude" clientside u-incfile="../../_fpclass/fpdbrgn1.inc" startspan --><!--#include file="../../_fpclass/fpdbrgn1.inc"--><!--webbot bot="AspInclude" endspan i-checksum="64934" -->
			<option VALUE="<%=FP_FieldHTML(fp_rs,"ID")%>"><%=FP_FieldHTML(fp_rs,"Description")%>
			</option>
			<!--webbot bot="AspInclude" clientside u-incfile="../../_fpclass/fpdbrgn2.inc" startspan --><!--#include file="../../_fpclass/fpdbrgn2.inc"--><!--webbot bot="AspInclude" endspan i-checksum="64936" -->
			</select><!--webbot bot="DatabaseRegionEnd" b-tableformat="FALSE" b-menuformat="TRUE" u-dbrgn2="../../_fpclass/fpdbrgn2.inc" i-groupsize="0" clientside preview=" <span style="color: rgb(0,0,0); background-color: rgb(255,255,0)">Results</span> " startspan --><!--webbot bot="DatabaseRegionEnd" endspan --></nobr></td>
		</tr>
		<tr>
			<td bgcolor="#C0C0C0" style="text-align: right"><b>Unit:</b></td>
			<td>
			<!--webbot bot="Validation" s-display-name="Unit No." s-data-type="Integer" s-number-separators="x" b-value-required="TRUE" i-minimum-length="1" i-maximum-length="5" s-validation-constraint="Greater than" s-validation-value="0" --><input type="text" name="Unit" size="5" value="<% =Unit %>" maxlength="5"></td>
		</tr>
		<tr>
			<td bgcolor="#C0C0C0" style="text-align: right"><b>Price:</b></td>
			<td>
			<!--webbot bot="Validation" s-display-name="Price" s-data-type="Number" s-number-separators=",." b-value-required="TRUE" i-minimum-length="1" i-maximum-length="7" --><input type="text" name="Price" size="7" value="<% =Price %>" maxlength="7"></td>
		</tr>
		<tr>
			<td style="text-align: right" bgcolor="#C0C0C0">
			<b>Auto update Spot Jobs:</b></td>
			<td>
			<input type="checkbox" name="AutoSpot" value="1" <% If Request("AutoSpot")=1 Then %> checked <% End If %> onClick="RefreshForm()"></td>
		</tr>
		<tr>
			<td style="text-align: right" bgcolor="#C0C0C0">
			<b>Auto update Regular Jobs:</b></td>
			<td>
			<input type="checkbox" name="AutoRegular" value="1" <% If Request("AutoRegular")=1 Then %> checked <% End If %> onClick="RefreshForm()"></td>
		</tr>
		<tr>
			<td style="text-align: right">
			<input type="submit" value="Update" name="Action"></td>
			<td>
			<p style="text-align: center">
			<input type="button" value="Delete" name="DelBut" style="float: left" onClick="DeletePrice()"></td>
		</tr>
	</table>
	
	<input type="hidden" value="<%= Request("Return") %>" name="Return">

	</form>

<% End If %>

<% End If %> 


<% 
If Request("Return") <> "" Then
	ReturnArray = Split(Request("Return"), "?") 
	
	For i = 1 to UBound(ReturnArray )
		
		Return = Return & ReturnArray(i)
			
		If i = 1 Then
			Return = Return & "?"
		Else
			Return = Return & "&"
		ENd If
		
	Next
%>

<p>
<a href="<%= Return %>">Return to <%= ReturnArray(0) %></a>
</p>

<% End If %>

<script language="javascript">
<!--
function DeletePrice()
{
	location.replace("price_delete_customer.asp?Action=Delete&AutoRegular=<% =Request("AutoRegular") %>&AutoSpot=<% =Request("AutoSpot") %>&ID=<% =Request("ID") %>&WorkType=<% =Request("WorkType") %>&return=<% =Request("Return") %>");
}

	function RefreshForm(){ //v3.0
		document.FrontPage_Form1.submit()
	}	
	
-->
</script>
    
</body>

</html>

(in reply to rdouglass)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: include leading zero in update query - 6/21/2006 11:11:09   
I see no where on that page are you collecting the data from the field BillUsing only where you're building the dropdown:

<select NAME="BillUsing" SIZE="1">

Which DRW was that supposed to be in?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to adam2804)
adam2804

 

Posts: 34
Joined: 6/6/2006
Status: offline

 
RE: include leading zero in update query - 6/21/2006 11:35:14   
I can select an option from the bill using dropdown and it returns the correct number. The DRW for the dropdown is:

<!--webbot bot="DatabaseRegionStart" s-columnnames="ID,Description" s-columntypes="200,200" s-dataconnection="BureauManagerSQL" b-tableformat="FALSE" b-menuformat="TRUE" s-menuchoice="Description" s-menuvalue="ID" b-tableborder="TRUE" b-tableexpand="TRUE" b-tableheader="TRUE" b-listlabels="TRUE" b-listseparator="TRUE" i-listformat="0" b-makeform="FALSE" s-recordsource s-displaycolumns="ID,Description" s-criteria s-order s-sql="SELECT     T.WorkType AS ID, T.WorkType + ' - ' + T.Description AS Description<br>FROM         Customers C INNER JOIN<br>                      TB_MasterPrices P ON C.CustomerID = P.ID INNER JOIN<br>                      WorkType T ON P.WorkType = T.WorkType INNER JOIN<br>                      TB_Billing b ON P.Billing_ID = b.ID INNER JOIN<br>                      TB_PriceType l ON P.PriceType_ID = l.ID<br>WHERE     (C.CustomerID LIKE '::ID::') AND (T.WorkType LIKE P.WorkType)<br>ORDER BY T.WorkType" b-procedure="FALSE" clientside suggestedext="asp" s-defaultfields="ID=" s-norecordsfound="No records returned." i-maxrecords="256" i-groupsize="0" botid="17" u-dblib="../../_fpclass/fpdblib.inc" u-dbrgn1="../../_fpclass/fpdbrgn1.inc" u-dbrgn2="../../_fpclass/fpdbrgn2.inc" preview=" <span style="color: rgb(0,0,0); background-color: rgb(255,255,0)">Database</span> " startspan b-InForm="TRUE" b-UseDotNET="FALSE" CurrentExt sa-InputTypes b-DataGridFormat="FALSE" b-DGridAlternate="TRUE" sa-CritTypes b-WasTableFormat="FALSE" --><!--#include file="../../_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT     T.WorkType AS ID, T.WorkType + ' - ' + T.Description AS Description FROM         Customers C INNER JOIN                       TB_MasterPrices P ON C.CustomerID = P.ID INNER JOIN                       WorkType T ON P.WorkType = T.WorkType INNER JOIN                       TB_Billing b ON P.Billing_ID = b.ID INNER JOIN                       TB_PriceType l ON P.PriceType_ID = l.ID WHERE     (C.CustomerID LIKE '::ID::') AND (T.WorkType LIKE P.WorkType) ORDER BY T.WorkType"
fp_sDefault="ID="
fp_sNoRecords="No records returned."
fp_sDataConn="BureauManagerSQL"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=True
fp_sMenuChoice="Description"
fp_sMenuValue="ID"
fp_sColTypes="&ID=200&Description=200&"
fp_iDisplayCols=2
fp_fCustomQuery=True
BOTID=17
fp_iRegion=BOTID
%>
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="45068" -->


The only issue I have is the value ommits the leading zero when running the update query

(in reply to rdouglass)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: include leading zero in update query - 6/21/2006 11:42:14   
quote:

I see no where on that page are you collecting the data from the field BillUsing


Sorry to repeat myself but this is the issue I'm up against right now. I see no where in your code where you're picking this field up so I don't know how you're writing it.

If you are writing it like this:

BillUsing = ::BillUsing::

that will probably remove the leading 0 since that is for numbers. You should be sure you're using:

BillUsing = '::BillUsing::'

which is for text. But again, without seeing it, I can't tell at all if that is the issue.

Without seeing the response.write(fp_sQry) or without seeing the BillUsing = ::BillUsing:: line, I can't help any more. Sorry.

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to adam2804)
adam2804

 

Posts: 34
Joined: 6/6/2006
Status: offline

 
RE: include leading zero in update query - 6/21/2006 12:04:45   
Thank you for your help, and sorry for wasting a bit of your time!

It was the BillUsing = '::BillUsing::' that I should have used.

The update was treating the figure as a number and thus omitting the leading zero.

Thanks again,

Adam

(in reply to rdouglass)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: include leading zero in update query - 6/21/2006 12:51:06   
quote:

BillUsing = '::BillUsing::'


That's too bad - that was my first reply but it must have been overlooked. :)

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to adam2804)
Page:   [1]
OutFront Discoveries

All Forums >> Web Development >> ASP and Database >> include leading zero in update query
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts