Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP SQL Statement Error

Status
Not open for further replies.

dhrehor

IS-IT--Management
Jun 16, 2005
23
US
Here is what I am trying to run

SELECT quarter, startdate, enddate, requiredquarterhours AS quarter, startdate, enddate, requiredquarterhours
FROM quarters WHERE quarter = DropDownList2.DataValueField


I get an error stating that DropDownList2.DataValueField cannot be bound.

I have also tried DropDownList2.DataTextField and gain the same error.

Thanks

Don
 
What is the data type of 'quarter' ?
Do you want the text or the value of the selected item of the ddl?
 
you have to do this:

WHERE quarter = DropDownList2.SelectedItem.value

-DNG
 
Still get this meesage

The multi-part identifier could not be bound

Don
 
Are you actually writing this?:
Code:
SELECT quarter, startdate, enddate, requiredquarterhours AS quarter, startdate, enddate, requiredquarterhours 
FROM quarters WHERE quarter = DropDownList2.DataValueField

You need to do this:
Code:
"SELECT quarter, startdate, enddate, requiredquarterhours AS quarter, startdate, enddate, requiredquarterhours 
FROM quarters WHERE quarter = " + DropDownList2.SelectedItem.value
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top