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

 

Comparing numbers in DRW

 
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 >> Comparing numbers in DRW
Page: [1]
 
MCD

 

Posts: 683
Joined: 3/19/2002
From: Al USA
Status: offline

 
Comparing numbers in DRW - 2/26/2007 7:37:54   
I need the DRW to yield the results of a query when using a number. I continue to get a "No records found" on the results page. Can someone tell me what is wrong with this SQL?

fp_sQry="SELECT * FROM cpac_table WHERE (cpac_work_order_number = '%cpac_work_order_number%')"


_____________________________

Author of " How To Build A Website With Duct Tape"
BeTheBall

 

Posts: 6385
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Comparing numbers in DRW - 2/26/2007 9:47:13   
Both the single quotes and the % need to go. Also, assuming the second instance of cpac_work_order_number is a form field, you would need to add Request.Form

fp_sQry="SELECT * FROM cpac_table WHERE (cpac_work_order_number = " & Request.Form("cpac_work_order_number")&")"

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to MCD)
MCD

 

Posts: 683
Joined: 3/19/2002
From: Al USA
Status: offline

 
RE: Comparing numbers in DRW - 2/26/2007 11:03:29   
Duane, the results are coming from a form. Your SQL gave me the following error.

Database Results Error
Description: [Microsoft][ODBC Microsoft Access Driver] Extra ) in query expression '(cpac_work_order_number = )'.
Number: -2147217900 (0x80040E14)
Source: Microsoft OLE DB Provider for ODBC Drivers

I tried adjusting the code but I am still doing something wrong. Can you or anyone else give further advice?

_____________________________

Author of " How To Build A Website With Duct Tape"

(in reply to BeTheBall)
Spooky

 

Posts: 26617
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Comparing numbers in DRW - 2/26/2007 11:22:53   
Whats the exact code youve used?

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to MCD)
MCD

 

Posts: 683
Joined: 3/19/2002
From: Al USA
Status: offline

 
RE: Comparing numbers in DRW - 2/26/2007 11:35:21   

quote:

ORIGINAL: Spooky

Whats the exact code youve used?

quote:

fp_sQry="SELECT * FROM cpac_table WHERE (cpac_work_order_number = " & Request.Form("cpac_work_order_number")&")"



Are you requesting the entire DRW code? I used what Duane had given me above except on one line. I had dieted the DRW before adding the SQL.

fp_sQry="SELECT * FROM cpac_table WHERE (cpac_work_order_number = " & Request.Form("cpac_work_order_number")&")"

_____________________________

Author of " How To Build A Website With Duct Tape"

(in reply to Spooky)
BeTheBall

 

Posts: 6385
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Comparing numbers in DRW - 2/26/2007 12:00:15   
Paste the code for the whole page. It appears perhaps the code is not getting the data from the form field. Is the form on the same page as the results?

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to MCD)
MCD

 

Posts: 683
Joined: 3/19/2002
From: Al USA
Status: offline

 
RE: Comparing numbers in DRW - 2/26/2007 12:22:47   
You are correct Duane, the form page is not in the SQL. That page is called form.htm

Here is the code:

<!--#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 * FROM cpac_table WHERE (cpac_work_order_number = " & Request.Form("cpac_work_order_number")&")"
fp_sDefault=""
fp_sNoRecords="No records returned."
fp_sDataConn="cpac_database"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=25
fp_fTableFormat=False
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_iDisplayCols=7
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="../../_fpclass/fpdbrgn1.inc"-->
<p><b>ID:</b> <%=FP_FieldVal(fp_rs,"ID")%></p>
<p><b>store:</b> <%=FP_FieldVal(fp_rs,"store")%></p>
<p><b>customer_name:</b> <%=FP_FieldVal(fp_rs,"customer_name")%></p>
<p><b>item:</b> <%=FP_FieldVal(fp_rs,"item")%></p>
<p><b>store_ofr:</b> <%=FP_FieldVal(fp_rs,"store_ofr")%></p>
<p><b>cpac_work_order_number:</b> <%=FP_FieldVal(fp_rs,"cpac_work_order_number")%></p>
<p><b>status:</b> <%=FP_FieldVal(fp_rs,"status")%></p>
<hr>
<!--#include file="../../_fpclass/fpdbrgn2.inc"-->


_____________________________

Author of " How To Build A Website With Duct Tape"

(in reply to BeTheBall)
BeTheBall

 

Posts: 6385
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Comparing numbers in DRW - 2/26/2007 12:37:04   
What does form.htm look like?

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to MCD)
MCD

 

Posts: 683
Joined: 3/19/2002
From: Al USA
Status: offline

 
RE: Comparing numbers in DRW - 2/26/2007 15:25:44   
Here is the part I think you are interested in.

<form method="POST" action="work_number/results.asp">
<p>
<input type="text" name="work_order" size="30">
<input type="submit" value="Submit" name="B1"> </p>
</form>

_____________________________

Author of " How To Build A Website With Duct Tape"

(in reply to BeTheBall)
BeTheBall

 

Posts: 6385
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Comparing numbers in DRW - 2/26/2007 19:43:04   
Ahhh. That explains it. The code I posted above would then need to be:

fp_sQry="SELECT * FROM cpac_table WHERE (cpac_work_order_number = " & Request.Form("work_order")&")"

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to MCD)
MCD

 

Posts: 683
Joined: 3/19/2002
From: Al USA
Status: offline

 
RE: Comparing numbers in DRW - 2/27/2007 6:07:50   

quote:

ORIGINAL: BeTheBall

Ahhh. That explains it. The code I posted above would then need to be:

fp_sQry="SELECT * FROM cpac_table WHERE (cpac_work_order_number = " & Request.Form("work_order")&")"

quote:

fp_sQry="SELECT * FROM cpac_table WHERE (cpac_work_order_number = " & Request.Form("work_order")&")"


Now I get the following error.

Database Results Error
Description: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
Number: -2147217913 (0x80040E07)
Source: Microsoft OLE DB Provider for ODBC Drivers

_____________________________

Author of " How To Build A Website With Duct Tape"

(in reply to BeTheBall)
BeTheBall

 

Posts: 6385
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Comparing numbers in DRW - 2/27/2007 8:58:39   
OK, next question then. In the database, is cpac_work_order_number a numeric field or text?

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to MCD)
MCD

 

Posts: 683
Joined: 3/19/2002
From: Al USA
Status: offline

 
RE: Comparing numbers in DRW - 2/27/2007 9:16:15   
A numeric field

_____________________________

Author of " How To Build A Website With Duct Tape"

(in reply to BeTheBall)
BeTheBall

 

Posts: 6385
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Comparing numbers in DRW - 2/27/2007 9:21:07   
Maybe this:

fp_sQry="SELECT * FROM cpac_table WHERE (cpac_work_order_number = " & Clng(Request.Form("work_order"))&")"

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to MCD)
MCD

 

Posts: 683
Joined: 3/19/2002
From: Al USA
Status: offline

 
RE: Comparing numbers in DRW - 2/27/2007 11:22:29   
That would give the following error

Microsoft VBScript runtime error '800a000d'

Type mismatch: 'Clng'

/record_edits/work_number/results.asp, line 45


_____________________________

Author of " How To Build A Website With Duct Tape"

(in reply to BeTheBall)
BeTheBall

 

Posts: 6385
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Comparing numbers in DRW - 2/27/2007 11:43:26   
Does it work if you hardcode in a number that you know exists in the db, like below (Replace the 1 with a number that exists in the cpac_work_order_number field of the table.)

fp_sQry="SELECT * FROM cpac_table WHERE (cpac_work_order_number = 1)"

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to MCD)
MCD

 

Posts: 683
Joined: 3/19/2002
From: Al USA
Status: offline

 
RE: Comparing numbers in DRW - 2/27/2007 16:02:05   
I still get the following

Database Results Error
Description: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
Number: -2147217913 (0x80040E07)
Source: Microsoft OLE DB Provider for ODBC Drivers

_____________________________

Author of " How To Build A Website With Duct Tape"

(in reply to BeTheBall)
BeTheBall

 

Posts: 6385
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Comparing numbers in DRW - 2/27/2007 16:58:43   
Does this work?

fp_sQry="SELECT * FROM cpac_table WHERE (cpac_work_order_number = '" & Request.Form("work_order") &"')"

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

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

All Forums >> Web Development >> ASP and Database >> Comparing numbers in DRW
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