0

Hi,

When debugging the page i am getting error("argumentexception was unhandled by user code"). Can any one help me on this.

in .aspx page:
<asp:DropDownList ID="ddlCategoryID" runat="server" CssClass="input"> </asp:DropDownList>

in .aspx.cs page:

pageload :
Bindmasterdata();

----

        DataTable dt = new DataTable();
        using (OracleConnection Con = new OracleConnection("SConnectionString"))
        {
            Con.Open();
            OracleCommand cmd = new OracleCommand("Select * from nts_advertisements", Con);
            OracleDataAdapter da = new OracleDataAdapter(cmd);
            da.Fill(dt);
        }
        ddlCategoryID.DataSource = dt;
        ddlCategoryID.DataTextField = "Category";
        ddlCategoryID.DataValueField = "Category";
        ddlCategoryID.DataBind();

Thanks in advance.

Regards,
Kavitha Kesav

5
Contributors
4
Replies
19
Views
3 Years
Discussion Span
Last Post by ggamble
1

using (OracleConnection Con = new OracleConnection("SConnectionString"))

you either need to supply the connection string there, or add the connection string to your web.config file and then reference the web.config when setting up your connections.

in web.config...

 <connectionStrings>
    <add name="connName" connectionString=" .. you fill this in ..."/>
 </connectionStrings>

in your code behind..

new OracleConnection(ConfigurationManager.ConnectionStrings["connName"].ConnectionString

Edited by JorgeM

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.