c# - Error when displaying data in a datalist from sqldatasource in asp project -
i building website class , have come across error can not find solution to. have dropdownlist on page displays cutomer name , sets selected value customer id selected sqldatasource (data tables access database - fig1) (this works fine have tested before added second sqldatasource). add datalist control page , second sqldatasource datalist bind to. configured datasource using configure data source wizard shown in fig2. use wizard test data returned query , see works, wizard shows data wanted returned. bind datalist data source , itemtemplate (in html source view) contains data bound labels show values:
products.name: <asp:label id="products_namelabel" runat="server" text='<%# eval("products.name") %>' /> <br /> technicians.name: <asp:label id="technicians_namelabel" runat="server" text='<%# eval("technicians.name") %>' /> <br /> incidents.dateopened: <asp:label id="incidents_dateopenedlabel" runat="server" text='<%# eval("incidents.dateopened") %>' /> <br /> incidents.dateclosed: <asp:label id="incidents_dateclosedlabel" runat="server" text='<%# eval("incidents.dateclosed") %>' /> <br /> incidents.description: <asp:label id="incidents_descriptionlabel" runat="server" text='<%# eval("incidents.description") %>' />
the labels bound data returned second source....or seem. when run , select customer should return data being selected in sqldatasource select statement, program crashes , gives error:
databinding: 'system.data.datarowview' not contain property name 'products'.
i not understand why saying datarowview not contain column name when sqldatasource returns when test in wizard. can please help?
p.s. sorry links imgur...apparently have have higher rep post pictures
i tried , generated html not prefixed table name in code.
i hand-added table name , reproduced error.
so, if have duplicate column names do, need modify sql statement use alias:
products.name products_name
Comments
Post a Comment