troubleshooting Question

ASP.NET regarding System.Data.OracleClient;

Avatar of toooki
toooki asked on
.NET ProgrammingC#ASP.NET
8 Comments2 Solutions856 ViewsLast Modified:
I have defined a SqlDataSource in my .aspx page this way:

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
                            ConnectionString="<%$ appSettings:MyConnectString %>"
                            ProviderName= "System.Data.OracleClient"
                            onselecting="SqlDataSource1_Selecting"
                            SelectCommand="MyPkg.MyProd1"
                            SelectCommandType="StoredProcedure">
                            <SelectParameters>
                            <asp:Parameter Name="resultCursor" Direction="Output" />
                            </SelectParameters>
                            </asp:SqlDataSource>

I use the above in the DropDownList in the same .aspx page:

                                    <asp:DropDownList ID="dd1" runat="server"
                                        DataSourceID="SqlDataSource1" DataTextField="F1"
                                        DataValueField="F1">
                                    </asp:DropDownList>

In the corresponding .cs page:
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.OracleClient; //can I get rid of this...?
        protected void SqlDataSource1_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
        {
            ((System.Data.OracleClient.OracleParameter)e.Command.Parameters[0]).OracleType =
                 System.Data.OracleClient.OracleType.Cursor;
        }

Is it possible for me to get rid of this line:
using System.Data.OracleClient;
in the above .cs page?

Although everything works above, I need to look for a way to get rid of "using System.Data.OracleClient; " from the .cs page.
But if I do so, the line under SqlDataSource1_Selecting does not compile.

Will be helpful if you could suggest something.
Thanks a lot.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 8 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros