Click here to Skip to main content
15,908,901 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When I run the following code locally it works fine, but I get the following error on firefox:
XML Parsing Error: no element found
Location: http://test.freecreditcards4all.com.asp1-10.dfw1-2.websitetestlink.com/testforconnection.aspx
Line Number 1, Column 1:
The code is:
C#
protected void Button1_Click(object sender, EventArgs e)
    {
     try
        {
         SqlConnection con = new SqlConnection(WebConfigurationManager.ConnectionStrings["PintooConnection"].ConnectionString);
            DataSet Ds = new DataSet();
            SqlDataAdapter Da = new SqlDataAdapter("Select * from Emails", con);
            Da.Fill(Ds);

            for (int i = 0; i < Ds.Tables[0].Rows.Count; i++)
            {
               Label1.Text = Label1.Text + i.ToString() ++ Ds.Tables[0].Rows[i][1].ToString() + " <br />";
                SqlConnection test = new SqlConnection(WebConfigurationManager.ConnectionStrings["PintooConnection"].ConnectionString);
                string qry = "Insert into test values ('" + Ds.Tables[0].Rows[i][1].ToString() + "','" + Ds.Tables[0].Rows[i][2].ToString() + "','" + Ds.Tables[0].Rows[i][3].ToString() + "','" + Ds.Tables[0].Rows[i][4].ToString() + "','" + Convert.ToDateTime(Ds.Tables[0].Rows[i][5].ToString()) + "')";
                SqlCommand cmd = new SqlCommand(qry, con);
                con.Open();
                cmd.ExecuteNonQuery();
                con.Close();
                cmd.Dispose();
            }
        }
        catch (Exception ex)
        {
            Label1.Text = ex.ToString();
        }
    }

.aspx code is here:
XML
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="testforconnection.aspx.cs" Inherits="Admin_testforconnection" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />

    </div>
    <asp:Label ID="Label1" runat="server" Text=""></asp:Label>
    </form>
    <% Response.ContentType = "text/HTML";%>
</body>
</html>
Posted
Updated 13-May-10 1:10am
v3
Comments
Ankur\m/ 13-May-10 7:37am    
I already answered this question. Have you deleted the original post?
Did you check my answer?

The error indicates that no content has been returned to the browser to
test it. You haven't indicated whether this exception occurs after a
button press, or if you can't get into the site at all.

If you can get no content anywhere, it indicates the button press is not the problem.
 
Share this answer
 
v3
i will suggest to read this post.
http://shivasoft.in/blog/microsoft/net/xml-parsing-error-no-element-found/[^]

it may solve your problem
 
Share this answer
 
v2
Okay, I will add the answer again.

The error means your application failed to produce any output at all. Usually that means that there was an exception before any output rendering took place.
Do you have exception handling in place? If yes, try looking through the logs to find out what caused it. You may check Event Log entries for any exception.
If nothing works out, try logging the error in Application_Error section in Global.asax file.

Hope it helps!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900