Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2010-11-18
3
Medium Priority
?
1,204 Views
Last Modified: 2012-10-06
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.
0
Comment
Question by:photostephen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 14

Accepted Solution

by:
raja_ind82 earned 1000 total points
ID: 34359037
0

Featured Post

Stressed Out?

Watch some penguins on the livecam!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question