Query error?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • maniacCow
    New Member
    • Aug 2010
    • 24

    Query error?

    Code:
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                                    ConnectionString="<%$ ConnectionStrings:foodcourtConnectionString %>" 
                                    SelectCommand="SELECT [foodname], [foodimg], [price], [stallid] FROM [foodtbl] WHERE ([stallid] = @stallid)">
                                    <SelectParameters>
                                        <asp:QueryStringParameter DefaultValue="<%=Session["stallid"] %>" Name="stallid" 
                                            QueryStringField="stallid" Type="Decimal" />
                                    </SelectParameters>
                                </asp:SqlDataSource>
    I having problem on the DefaultValue part. Kenot get the Session["stallid"]. Error there... Anyone can help..?
  • benwizzle
    New Member
    • May 2010
    • 72

    #2
    If your using the Session variable to get the DefaultValue, why don't you try using a session parameter? I'm not quite sure that you can use the Session variable like that as the default value(could be wrong)

    Comment

    • maniacCow
      New Member
      • Aug 2010
      • 24

      #3
      Yes. I get the solution already. It is as what you mention; benwizzle

      Code:
      <SelectParameters><asp:SessionParameter Name="stallid" SessionField="stallid" DefaultValue="" /></SelectParameters>

      Comment

      Working...