asp.net - Problems with Formview showing details of Gridview selected row -


i trying have user select row in grid view , have set of details entry display in formview. currently, getting error "invalid column name 's.sprayid' ". have encountered several issues , out of ideas. have posted code below. ideas on how fix or better way it? thanks.

<asp:gridview id="gvhistory" runat="server" datasourceid="dshistory" allowpaging="true" allowsorting="true" cellpadding="4" forecolor="#333333" gridlines="none" datakeynames="sprayid">     <alternatingrowstyle backcolor="white" forecolor="#284775"></alternatingrowstyle>     <columns>         <asp:commandfield showselectbutton="true"></asp:commandfield>     </columns>     <editrowstyle backcolor="#999999"></editrowstyle>      <footerstyle backcolor="#5d7b9d" font-bold="true" forecolor="white"></footerstyle>      <headerstyle backcolor="#5d7b9d" font-bold="true" forecolor="white"></headerstyle>      <pagerstyle horizontalalign="center" backcolor="#284775" forecolor="white"></pagerstyle>      <rowstyle backcolor="#f7f6f3" forecolor="#333333"></rowstyle>      <selectedrowstyle backcolor="#e2ded6" font-bold="true" forecolor="#333333"></selectedrowstyle>      <sortedascendingcellstyle backcolor="#e9e7e2"></sortedascendingcellstyle>      <sortedascendingheaderstyle backcolor="#506c8c"></sortedascendingheaderstyle>      <sorteddescendingcellstyle backcolor="#fffdf8"></sorteddescendingcellstyle>      <sorteddescendingheaderstyle backcolor="#6f8dae"></sorteddescendingheaderstyle> </asp:gridview> <asp:sqldatasource id="dshistory" runat="server" connectionstring='<%$ connectionstrings:wsfconnectionstring %>' selectcommand="select [sprayid], [date], [timestart] [spray] ([date] >= (getdate() - 7)) order [date] desc, [timestart] desc"></asp:sqldatasource> <asp:formview id="fvhistorydetail" runat="server" cellpadding="4" forecolor="#333333" datasourceid="dshistorydetail" datakeynames="sprayid">     <edititemtemplate>         sprayid:         <asp:label text='<%# eval("sprayid") %>' runat="server" id="sprayidlabel1" /><br />         <asp:linkbutton runat="server" text="update" commandname="update" id="updatebutton" causesvalidation="true" />&nbsp;<asp:linkbutton runat="server" text="cancel" commandname="cancel" id="updatecancelbutton" causesvalidation="false" />     </edititemtemplate>      <editrowstyle backcolor="#999999"></editrowstyle>      <footerstyle backcolor="#5d7b9d" font-bold="true" forecolor="white"></footerstyle>      <headerstyle backcolor="#5d7b9d" font-bold="true" forecolor="white"></headerstyle>      <insertitemtemplate>         <asp:linkbutton runat="server" text="insert" commandname="insert" id="insertbutton" causesvalidation="true" />&nbsp;<asp:linkbutton runat="server" text="cancel" commandname="cancel" id="insertcancelbutton" causesvalidation="false" />     </insertitemtemplate>     <itemtemplate>         sprayid:         <asp:label text='<%# eval("sprayid") %>' runat="server" id="sprayidlabel" /><br />      </itemtemplate>      <pagerstyle horizontalalign="center" backcolor="#284775" forecolor="white"></pagerstyle>      <rowstyle backcolor="#f7f6f3" forecolor="#333333"></rowstyle> </asp:formview> <asp:sqldatasource id="dshistorydetail" runat="server" connectionstring='<%$ connectionstrings:wsfconnectionstring %>' selectcommand="select s.sprayid 'id', [date], timestart 'time start', startlocationdescription 'start', endlocationdescription 'end', v.vehiclenumber, (a.firstname + a.lastname) 'applicator', c.tradename 'chemical' spray s join vehicle v on s.vehicleid = v.vehicleid join applicator on s.applicator1id = a.applicatorid join spraychemicalsused scu on scu.sprayid = s.sprayid join chemicalsused cu on scu.chemusedid = cu.chemusedid join chemical c on cu.chemid = c.chemid ([s.sprayid] = @sprayid)">     <selectparameters>         <asp:controlparameter controlid="gvhistory" propertyname="selectedvalue" defaultvalue="1" name="sprayid" type="int32"></asp:controlparameter>     </selectparameters> </asp:sqldatasource> 

the issue select command query:

select s.sprayid 'id', [date], timestart 'time start', startlocationdescription 'start', endlocationdescription 'end', v.vehiclenumber, (a.firstname + a.lastname) 'applicator', c.tradename 'chemical' spray s join vehicle v on s.vehicleid = v.vehicleid join applicator on s.applicator1id = a.applicatorid join spraychemicalsused scu on scu.sprayid = s.sprayid join chemicalsused cu on scu.chemusedid = cu.chemusedid join chemical c on cu.chemid = c.chemid ([s.sprayid] = @sprayid) 

does column exist , name correct first thing check.

i open in sql management query or whatever database tool using , working in there first. should quite apparent issue gui highlight errors in sql syntax.


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -