Log in

View Full Version : Need Help with Custom SQL Statments



Mehok
03-11-2008, 08:43 PM
ok guys here is the biggy

I have an aspx page in it there is a datalist and to it i would like to connect a textbox and 2 dropdown lists

this is a school project where i have the datalist display movies and its connected to a database where there is a directorFirstName and ActorFirst Name

what i want is when someone enters for example John and pulls down from the dropdown Actor it would show info on the datalist the movis that John Travolta was in

What i am looking for is a custom SQL statment to do this

Please and thank you

NXArmada
03-12-2008, 01:07 PM
i suggest you check out the MySQL (http://www.mysql.com) website for details on how to construct a query. Assuming you are using MySQL

Sample MySQL query


SELECT * FROM `movies` WHERE `actor` LIKE CONVERT(_utf8 '%john%' USING latin1) COLLATE latin1_swedish_ci;

Mehok
03-13-2008, 09:55 AM
ok i dont think this is right

John is enterd by the user and actor is one of the options on a dropdown list

codeexploiter
03-13-2008, 09:59 AM
Basically you have to extract whatever the user enters in the form field using your server-side part. After storing the values in some variables you can construct an SQL statement like the above one and instead of specifying 'john' directly in the above statement you have to fill it from your variable.