Help with sqldatasource parameters and passing the value

binici

Active member
Joined
Sep 11, 2006
Messages
26
Programming Experience
Beginner
Hello:
I have come to a tricky part of my webproject. This maybe a bit confusing.
As of now I have two sqldatasources:
VB.NET:
<asp:SqlDataSource ID="sqlBrokersAgentsRecips" runat="server" ConnectionString="<%$ AppSettings:connectionstring %>" ProviderName="System.Data.SqlClient" SelectCommandType="StoredProcedure" SelectCommand="callcenterdev..spGetBrokersAgentsForRecips">
    <SelectParameters>
        <asp:Parameter Name="OfficeId" DefaultValue="88430760" />
    </SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource  ID="sqlMembersOfficeId" runat="server" ConnectionString="<%$ AppSettings:connectionstring %>" ProviderName="System.Data.SqlClient" SelectCommandType="Text" SelectCommand="SELECT m.Office_Number FROM rapdata..Member m WITH(NOLOCK) WHERE Member_Number = @sesBrokerId">
    <SelectParameters>
        <asp:SessionParameter SessionField="sesBrokerId" Name="sesBrokerId" />
    </SelectParameters>
</asp:SqlDataSource>
The sqlMembersOfficeId retrieves the office_number I need correctly, (I know because I have checked the db value and have outputted the value on a label control).
Now the tricky part I am trying to understand is, I need the office_id to be passed for the sqlBrokersAgentsRecips (as you can see I just manually add the value for now to test). Upon doing so I will be able to bind a dropdownlist with the correct members within the office_number.
VB.NET:
<asp:DropDownList ID="BrokerAgentNamesDD" runat="server" DataSourceID="sqlBrokersAgentsRecips" DataTextField="Agent_Name" DataValueField="Member_Number">
</asp:DropDownList>
I know in asp 3.0 you could just sub out all your stored procedures and call them anytime, but looks like its much more elaborate in .NET.
Thanks for your help!
 

binici

Active member
Joined
Sep 11, 2006
Messages
26
Programming Experience
Beginner
I was doing some reading and it looks like I may need to use SqlDataSourceStatusEventArgs for add the output to a control, variable, ect?
 
Top Bottom