2uzhan.com
Advertisement
Now Place:2uzhan.com » code behind page "argumentexception was unhandled by user code"

code behind page "argumentexception was unhandled by user code"

Web Development @ February 11, 2014   Views: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

--------------Solutions-------------

new OracleConnection("SConnectionString")

I think you need to pass an actual connection string.

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

are you getting value in DataTable (dt) ?

Can you post the full Inner Exception text?

I'm attempting to simplify my fundraising page, and would like to show exactly how much each donation would help us out. I've listed the options below, but I would like ...

I'm currently doing some encoding work to protect a site from XSS attacks. We've stuck a bunch of <script>debugger;</script> tags in the db. Dispite my best efforts, the strings I've ...

    //The php section of the code

           <?php

           function getJSONFromDB($sql){

           $conn = mysqli_connect("localhost", "root", "","rent");

           //echo $sql;

           $result = mysqli_query($conn, $sql)or die(mysqli_error());

           $arr=array();

           while($row = mysqli_fetch_assoc($result)) {

                   $arr[]=$row;

               }

               return json_encode($arr); ...
© 2018 2uzhan.com Contact