navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

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

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

Microsoft MVP

 

"WHERE (((Test.id)="' ??? "'');"

 
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 >> "WHERE (((Test.id)="' ??? "'');"
Page: [1]
 
WRXSTi

 

Posts: 30
Joined: 2/7/2002
From: MA USA
Status: offline

 
"WHERE (((Test.id)="' ??? "'');" - 2/26/2002 10:13:50   
Below is my code. I want to capture the the id value from Querystring("id") and place it in the the WHERE condition below. It does'nt seem to be working. if I hard code a numeric value "WHERE (((Test.id)=2);" it works. If I use "WHERE (((Test.id)="' & CMD & "');" it fails?

What is the correct code ? I'm witing my asp and not letting FP write any dB code.

 
<%
user = Session("UserName")

'Get Querysting info.
CMD = Request.Querystring("id")

Set cnn1 = Server.CreateObject("ADODB.Connection")
openStr = "driver={Microsoft Access Driver (*.mdb)};" & _
"dbq=" & Server.MapPath("./fpdb/meatheads.mdb")
cnn1.Open openStr,"",""

sql = "SELECT Test.id, " & _
"Test.subject, " & _
"Test.condition, " & _
"Test.price, " & _
"Test.category, " & _
"Test.email, " & _
"Test.userid " & _
"FROM Test " & _
"WHERE (((Test.id)=' & CMD & ');"

Set rsMbrs = Server.CreateObject("ADODB.Recordset")
rsMbrs.Open sql, cnn1, adOpenForwardOnly, adLockReadOnly, adCmdText
%>


Me
ginnie

 

Posts: 527
From: St. Louis MO USA
Status: offline

 
RE: "WHERE (((Test.id)="' ??? "'');" - 2/26/2002 10:31:11   
Try this, assuming Test.id is numeric:

"WHERE ((Test.id)=" & CMD & ");"

Or this if it's a string:

"WHERE ((Test.id)='" & CMD & "');"

Looks like you have an extra opening parenthesis in the "Where" line too.

NOTE: No apostrophes/single quotes around numeric fields, just text fields.

ginnie
Global Presence Web Design



Edited by - ginnie on 02/26/2002 10:34:05

(in reply to WRXSTi)
WRXSTi

 

Posts: 30
Joined: 2/7/2002
From: MA USA
Status: offline

 
RE: "WHERE (((Test.id)="' ??? "'');" - 2/26/2002 10:50:25   
Test.id is a autonumber key value.

I changed the code to your suggestion of
"WHERE (((Test.id)=" & CMD & ");"
however I now get the following error when the page loads.
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error in query expression '(((Test.id)=3);'.

/testitemdetail.asp, line 32

Line 32 is (shown in previous post)
rsMbrs.Open sql, cnn1, adOpenForwardOnly, adLockReadOnly, adCmdText

Any thougths as why this is?

Me

(in reply to WRXSTi)
ginnie

 

Posts: 527
From: St. Louis MO USA
Status: offline

 
RE: "WHERE (((Test.id)="' ??? "'');" - 2/26/2002 10:59:36   
It looks like you didn't remove the extra opening parenthesis that I mentioned.

Should be:

"WHERE ((Test.id)=" & CMD & ");"

You have:

"WHERE (((Test.id)=" & CMD & ");"


Note the extra opening parenthesis around Test.id



ginnie
Global Presence Web Design

(in reply to WRXSTi)
WRXSTi

 

Posts: 30
Joined: 2/7/2002
From: MA USA
Status: offline

 
RE: "WHERE (((Test.id)="' ??? "'');" - 2/26/2002 11:04:31   
Boy was that a bonehead move...

thank you very much.


Me

(in reply to WRXSTi)
ginnie

 

Posts: 527
From: St. Louis MO USA
Status: offline

 
RE: "WHERE (((Test.id)="' ??? "'');" - 2/26/2002 11:08:24   
You're welcome!

Me

(in reply to WRXSTi)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> "WHERE (((Test.id)="' ??? "'');"
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