Need help with ASP database call

LincLinc OwnerDetroit Icrontian
edited December 2003 in Internet & Media
I have a field in a Access database called "waterproof" as datatype Yes/No.

This is the relevant portion of my html form and asp code to assemble the SQL query. My code goes nuts and gives me an error on the Conn.Open(DSN); line (not shown) when I try to enter anything for the waterproof field. It does the same for my other Yes/No field, and for one other field that I may ask another question about later.

This is the html form field:

[PHP]
Waterproof:
<select name="waterproof">
<option value=""></option>
<option value="TRUE">Yes</option>
<option value="FALSE">No</option>
</select>
[/PHP]

skipping all the stuff inbetween and condensing what I know works ok, here is where the waterproof variable is handled:
sql = "SELECT * FROM main WHERE (";

var waterproof1 = String(Request("waterproof"));

if (waterproof1 != "")
{
	if (comma == "TRUE")
		sql = sql + " and";
	sql = sql + " waterproof = '" +  waterproof1 + "'";
	comma = "TRUE";
}

sql = sql + ") ORDER BY style";

Any thoughts?

Comments

  • shwaipshwaip bluffin' with my muffin Icrontian
    edited December 2003
    SELECT * FROM main WHERE (and waterproof = 'waterproof1')ORDER BY style"


    I've not done much sql, but that is what you get if comma is true. Is the WHERE(and...) possibly part of the problem?
  • LincLinc Owner Detroit Icrontian
    edited December 2003
    no, sorry, ignore the comma bit. That's incase additional statements were appended before that. It's not what the problem is here. I think it has more to do with datatype maybe?
Sign In or Register to comment.