简体   繁体   中英

Populating SQLDataSource from Sessions in VB.NET

I have the below code and I am trying to make the connection string as well as the parameters that the pass to the stored procedure use values stored in a session. How can this be done?

    <asp:SqlDataSource ID="sqlds" runat="server" ConnectionString="<%# Session("ConnStrEP") %>" SelectCommandType="StoredProcedure" SelectCommand="GetGenInfo_Mines">
    <SelectParameters>
    <asp:Parameter DefaultValue="6" Name="RevNo" Type="String" />
    <asp:Parameter DefaultValue="1003992" Name="AppNo" Type="String" />

    </SelectParameters>
</asp:SqlDataSource>

An example of how to pass a session parameter can be found here:

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.sessionparameter.aspx

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