Solved

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

Posted on 2010-11-18
3
1,129 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
3 Comments
 
LVL 14

Accepted Solution

by:
raja_ind82 earned 250 total points
ID: 34359037
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows how to recover a database from a user managed backup

947 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now