none
A field or property with the name 'x' was not found on the selected data source.

    Question

  • I have a gridview with fields bound to a stored procedure in sql server, and I'm getting the error: A field or property with the name 'x' was not found on the selected data source.
    The stored procedure has multiple select statements.  The gridview is bound to fields in the second select statement of my stored procedure.  If I comment out the first select statement, I don't get the error.  It's like the second select statement isn't being recognized.  Any ideas?
    Friday, August 13, 2010 8:52 PM

Answers

  • Sounds like you bound to the wrong object (DataSource and/or DataMember not set properly) or you mistyped a field name.

    You are going to need to be more detailed about what your code is actually doing.  Preferably, post a code sample.

     

    Friday, August 13, 2010 11:12 PM
  • Hi bukkybu,

     

    Welcome to MSDN forums!

     I am interested in helping.

    You can comment out the first select statement, it means you get a right data source.

    I think your problem may relate to the bind syntax, you may mistype a field with “x”, would you please check your .aspx pages.

    By the way, you can get more help here:  http://forums.asp.net/

    Hope these helps, if you have any problems, please feel free to let me know.

     

    Best Regards,

    Alan Chen

    ________________________________________

    Please remember to mark the replies as answers if they help and unmark them if they provide no help

    Wednesday, August 18, 2010 2:28 AM
  • Thanks for your response.  I found my error.  The second select statement wasn't being executed because I had both references to Table[0] (the first select statement).  Once I changed it to reference Table[0] for the first value and Table[1] for the second value, it worked fine.  Thanks again!
    • Marked as answer by bukkybu Friday, August 20, 2010 1:31 PM
    Friday, August 20, 2010 1:30 PM
  • Thanks for your response.  I found my error.  The second select statement wasn't being executed because I had both references to Table[0] (the first select statement).  Once I changed it to reference Table[0] for the first value and Table[1] for the second value, it worked fine.  Thanks again!
    • Marked as answer by bukkybu Friday, August 20, 2010 1:31 PM
    Friday, August 20, 2010 1:30 PM

All replies

  • Sounds like you bound to the wrong object (DataSource and/or DataMember not set properly) or you mistyped a field name.

    You are going to need to be more detailed about what your code is actually doing.  Preferably, post a code sample.

     

    Friday, August 13, 2010 11:12 PM
  • Hi bukkybu,

     

    Welcome to MSDN forums!

     I am interested in helping.

    You can comment out the first select statement, it means you get a right data source.

    I think your problem may relate to the bind syntax, you may mistype a field with “x”, would you please check your .aspx pages.

    By the way, you can get more help here:  http://forums.asp.net/

    Hope these helps, if you have any problems, please feel free to let me know.

     

    Best Regards,

    Alan Chen

    ________________________________________

    Please remember to mark the replies as answers if they help and unmark them if they provide no help

    Wednesday, August 18, 2010 2:28 AM
  • Thanks for your response.  I found my error.  The second select statement wasn't being executed because I had both references to Table[0] (the first select statement).  Once I changed it to reference Table[0] for the first value and Table[1] for the second value, it worked fine.  Thanks again!
    • Marked as answer by bukkybu Friday, August 20, 2010 1:31 PM
    Friday, August 20, 2010 1:30 PM
  • Thanks for your response.  I found my error.  The second select statement wasn't being executed because I had both references to Table[0] (the first select statement).  Once I changed it to reference Table[0] for the first value and Table[1] for the second value, it worked fine.  Thanks again!
    • Marked as answer by bukkybu Friday, August 20, 2010 1:31 PM
    Friday, August 20, 2010 1:30 PM