本文介绍了当我使网站在线且在本地时出错,没有错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在本地运行以下代码时,它可以正常工作,但是在firefox上出现以下错误:

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:

代码为:

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代码在这里:


.aspx code is here:

<%@ 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>

推荐答案




这篇关于当我使网站在线且在本地时出错,没有错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 06:07