SQL Statement in Gridview
eveloc | Posted 12:53am 1. May 2009 Server Time |
I have a Gridview using an Access datasource. On my form, there are 3 dropdown lists. The sql statement in the selectcommand of the AccessDataSouce plugs the values of the 3 dropdown lists into the sql statement and it is suppose to populate a gridview. This only works with one of the dropdowns. Here is my sql statement:
SELECT Street.*, Sites_Elem.elem, Sites_Elem.elem_desc, Sites_High.high, Sites_High.high_desc, Sites_Middle.mid, Sites_Middle.mid_desc FROM Sites_Elem INNER JOIN ((Street INNER JOIN Sites_High ON Street.high = Sites_High.high) INNER JOIN Sites_Middle ON Street.mid = Sites_Middle.mid) ON Sites_Elem.elem = Street.ele WHERE (sites_high.high = @highsch or sites_middle.mid = @midd or sites_elem.elem = @elemen) ORDER BY Street.street
It only works when I select something from the "Midd" dropdown list. Do you see anything wrong with the sql? |
bbcompent1 | Posted 10:16am 7. July 2009 Server Time |
Can you give us a snapshot of your schema?
Example:
Table1
- Col 1
- Col 2
- Col 3
Table2
- Col 1
- Col 2
- Col 3
Table3
- Col 1
- Col 2
If we can get an idea of your DB structure, we may be better able to help you.
Reply to Post SQL Statement in Gridview
|
|
|