Link to home
Start Free TrialLog in
Avatar of photostephen
photostephen

asked on

Setting the BindByName when using Oracle.DataAccess.Client with a Microsoft asp:SqlDataSource control

I have a Microsoft asp:SqlDataSource control on my ASP.net page.  In the SelectCommand, I use Bind variables.

My problem is that when I coded the page using the Microsoft provider (System.Data.OracleClient), the bind variables are bound by name.  Now I want to switch to the Oracle provider (Oracle.DataAccess.Client) and the bind variables are bound by position.  I have hundreds of pages with these controls, so I do not want to have to recode each page.

So how do I set the Oracle provider (Oracle.DataAccess.Client) to use the Bind by Name.

Here is a sample of my code, as it works with the Microsoft provider.

<asp:SqlDataSource ID="SqlDSf2" runat="server" ConnectionString="<%$ ConnectionStrings:isafedata.corractions %>" ProviderName="<%$ ConnectionStrings:isafedata.corractions.ProviderName %>" 
SelectCommand="
        SELECT RL_ID_PK, RL_REGION FROM REGION_L, SYSTEM_CHARACTERISTICS, USER_STORE
        WHERE /* LSQL_AUTH('RL_ID_PK', :fldparmUserID ,RL_ID_PK)=1  */ :fldparmUserID = :fldparmUserID and   region_l.ARCHIVE_REC = 0
        and RL_ID_PK = SYSC_REGION
        AND US_USER = :fldparmUserID
        AND (SYSC_BUSINESS_GROUP = :parmf1 OR :parmf1 = '0')
        AND (sysc_business_group = US_BUSINESS_GROUP or US_BUSINESS_GROUP = '0')
        AND (sysc_region = us_region OR us_region = '0')
        union select 0, ' All'     from dual  ORDER BY RL_REGION
      "> 
<SelectParameters>
 <asp:ControlParameter ControlID="drdf1"  DefaultValue="all" Name="parmf1"  PropertyName="SelectedValue" />
 <asp:ControlParameter ControlID="GVTxtUserID"  DefaultValue="all" Name="fldparmUserID"  PropertyName="Text" />
</SelectParameters>
</asp:SqlDataSource>

Open in new window


The web.config contains the ConnectionStrings:isafedata.corractions information.
ASKER CERTIFIED SOLUTION
Avatar of raja_ind82
raja_ind82
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial