I am working with a Detailsview. I am displaying information from a number of different tables, and so when I configure the datasource I have to specify a custom sql statement. I can get it to display the right columns, but I cannot seem to be able to use a where statement.
I am wanting to display the info in the Detailsview based on what is entered into a textbox, but I get an error when I try to add in the where statement. Can someone tell me what I am missing here?
Thanks
Just add WHEREsomefield=@.textboxvalue in your SQL Query. Then (if in VS 2005), hit the refresh parameters button, and choose where to pull @.textboxvalue from (Parameter type would be control, and the ControlID would be Textbox1).|||Thanks. It was the @. that I was missing.
|||Binding an SQL WHERE clause to a free-text field to return just one record sounds to me rather dodgy, as it indicates that the database design could be poor. Normally a DetailsView is used as part of a master-detail design and should be bound to the primary key of the master table.
No comments:
Post a Comment