简体   繁体   中英

Checking if a bound column exists

I have an SQL stored Procedure that, based on values in the database, may have a certain column in but not always. So when I'm binding the column as so <%#DataBinder.Eval(Container.DataItem, "ADDRESS1")%> when the condition in the SP is met to not display this column the page results in an error. I can see why the error occurs because there is no column to pull through but is there any IF clause that can can do a check to find out if this exists before attempting to access it?

I would have your SP create the column always. Then when databinding make the decision there to display or not to display.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM