Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: radio buttons and where conditions


Message #1 by kavitha_baskar@h... on Thu, 21 Jun 2001 21:41:28
Hi,

I am not getting any error but the query is not returning anything.  I am 

using msaccess and in access I have semester1 as a YES/NO data type and in 

the form I have semester as a radio button with two values. Can someone 

help me? 



SQLtemp = "SELECT course_id, title, grade_level, semester1 FROM courseInfo 

WHERE grade_level = '" & Request.form("grade_level") & "' AND semester1 = 

'" & Request.form("semester") & "' "



when I run it without the AND semester1 = ..., it works perfectly.



Kavitha.
Message #2 by "Chris Sano" <t-csano@m...> on Thu, 21 Jun 2001 13:57:02 -0700
Are you sure that the request.form( "semester" ) element has data in it?

If the query runs without any data being in semester then it's querying

the database looking for a row where the semester1 column is blank,

which according to your explanation, doesn't exist.



What I would do here is echo the query string to the browser using the

write method of the response object (response.write) and make sure the

query string is output correctly.



-----Original Message-----

From: kavitha_baskar@h... [mailto:kavitha_baskar@h...]

Sent: Thursday, June 21, 2001 2:41 PM

To: ASP Databases

Subject: [asp_databases] radio buttons and where conditions



Hi,

I am not getting any error but the query is not returning anything.  I

am

using msaccess and in access I have semester1 as a YES/NO data type and

in

the form I have semester as a radio button with two values. Can someone

help me?



SQLtemp =3D "SELECT course_id, title, grade_level, semester1 FROM

courseInfo

WHERE grade_level =3D '" & Request.form("grade_level") & "' AND 

semester1

=3D

'" & Request.form("semester") & "' "



when I run it without the AND semester1 =3D ..., it works perfectly.



Kavitha.





Message #3 by "Drew, Ron" <RDrew@B...> on Thu, 21 Jun 2001 17:01:35 -0400
 

Dim strSemester

strSemester = Request.form("semester")

Response.Write strSemester



You should see YES or NO 



-----Original Message-----

From: kavitha_baskar@h... [mailto:kavitha_baskar@h...]

Sent: Thursday, June 21, 2001 5:41 PM

To: ASP Databases

Subject: [asp_databases] radio buttons and where conditions





Hi,

I am not getting any error but the query is not returning anything.  I am 

using msaccess and in access I have semester1 as a YES/NO data type and in 

the form I have semester as a radio button with two values. Can someone 

help me? 



SQLtemp = "SELECT course_id, title, grade_level, semester1 FROM courseInfo 

WHERE grade_level = '" & Request.form("grade_level") & "' AND semester1 = 

'" & Request.form("semester") & "' "



when I run it without the AND semester1 = ..., it works perfectly.



Kavitha.





Message #4 by kavitha_baskar@h... on Fri, 22 Jun 2001 00:35:45
What I am getting now is an error:

Error Type:

Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)

[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.



this is the form part that accepts the input....

<input type="radio" name="semester" value="True"> Semester 1

<input type="radio" name="semester" value="False"> Semester 2



my sql statement which gives the above error...

SQLtemp = "SELECT course_id, title, grade_level, semester1 FROM courseInfo WHERE 

grade_level = '" & Request.Form("grade_level") & "' AND semester1 = '" & 

Request.Form("semester") & "'"



and in MS Access I have

semester1 as 

Data type: YES/NO  and Format: True/False



any idea why? 









> Are you sure that the request.form( "semester" ) element has data in it?

> If the query runs without any data being in semester then it's querying

> the database looking for a row where the semester1 column is blank,

> which according to your explanation, doesn't exist.

> 

> What I would do here is echo the query string to the browser using the

> write method of the response object (response.write) and make sure the

> query string is output correctly.

> 

> -----Original Message-----

> From: kavitha_baskar@h... [mailto:kavitha_baskar@h...]

> Sent: Thursday, June 21, 2001 2:41 PM

> To: ASP Databases

> Subject: [asp_databases] radio buttons and where conditions

> 

> Hi,

> I am not getting any error but the query is not returning anything.  I

> am

> using msaccess and in access I have semester1 as a YES/NO data type and

> in

> the form I have semester as a radio button with two values. Can 

someone

> help me?

> 

> SQLtemp =3D "SELECT course_id, title, grade_level, semester1 FROM

> courseInfo

> WHERE grade_level =3D '" & Request.form("grade_level") & "' AND 

> semester1

> =3D

> '" & Request.form("semester") & "' "

> 

> when I run it without the AND semester1 =3D ..., it works perfectly.

> 

> Kavitha.

> 

> 

Message #5 by "Drew, Ron" <RDrew@B...> on Fri, 22 Jun 2001 08:12:10 -0400

You may be making it hard on yourself..

Try changing the DB to a text field 3 positions long...

change the radio buttons to values of YES and NO



Also..you may have a problem with the form itself...Do you really want to

have the visitor select Semester 1 or Semester 2??  Looks like you set up 2

columns in the DB and are trying the match against one choice on the

form....If so..something like this will work along with the appropriate

request.form..

<p>

<FONT FACE="VERDANA, ARIAL" size="3"><B>Semester1?</B></FONT>

<INPUT TYPE="radio" NAME="semester1" VALUE="YES">Yes

<INPUT TYPE="radio" NAME="semester1" VALUE="NO ">No

<p>

<FONT FACE="VERDANA, ARIAL" size="3"><B>Semester2?</B></FONT>

<INPUT TYPE="radio" NAME="semester2" VALUE="YES">Yes

<INPUT TYPE="radio" NAME="semester2" VALUE="NO ">No



-----Original Message-----

From: kavitha_baskar@h... [mailto:kavitha_baskar@h...]

Sent: Thursday, June 21, 2001 8:36 PM

To: ASP Databases

Subject: [asp_databases] RE: radio buttons and where conditions





What I am getting now is an error:

Error Type:

Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)

[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria

expression.



this is the form part that accepts the input....

<input type="radio" name="semester" value="True"> Semester 1

<input type="radio" name="semester" value="False"> Semester 2



my sql statement which gives the above error...

SQLtemp = "SELECT course_id, title, grade_level, semester1 FROM courseInfo

WHERE 

grade_level = '" & Request.Form("grade_level") & "' AND semester1 = '" & 

Request.Form("semester") & "'"



and in MS Access I have

semester1 as 

Data type: YES/NO  and Format: True/False



any idea why? 






  Return to Index