ty_zjp
2015-05-19 13:11
采纳率: 0%
浏览 1.9k

为什么ASP.NET程序运行时不执行,也不报错?急急,哪位大蚁帮我一把戏?

点发布时,屏幕闪一下,没有任何提示,不进行验证,也没有加到SQL2005库中!

前台:
<%@ Page Language="C#" validateRequest="false" CodeFile="kjxm_Edit.aspx.cs" Inherits="As_Tzxm_Edit" %>
<%@ Register TagPrefix="FCKeditorV2" Namespace="FredCK.FCKeditorV2" Assembly="FredCK.FCKeditorV2" %>


</head>
<body class="bodybk">
    <form id="Form1" method="post" runat="server">
        <!--页面布局-->
        <table borderColor="black" cellspacing="0" cellpadding="4" width="100%" bgColor="white"             border="1">
            <tr>
<td height="30" colspan="2" align="center"  class="font_1">发 布 信  息</td>



机构名称:/asp:Label
/asp:TextBox(*)


投资性质:

/asp:DropDownList (*)


投资领域:


/asp:CheckBoxList (*)


公司介绍:
/FCKEDITORV2:FCKEDITOR
        <tr>
                            <td><asp:button id="btn_3" runat="server" CssClass="btn3_mouseout" Text="提 交" Width="70px" OnClick="btn3_Click"></asp:button></td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>

    </form>
</body>

后台:

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class As_Tzxm_Edit : System.Web.UI.Page
{

private void Kjxm_Big()//读取分类
{
    string sql = "select * from Mir_Type where TypeTitleId=" + 2 + " order by TypeId ";
    DataTable dt = Class1.ExecSel(sql);
    this.CheckBoxList1.DataSource = dt;
    this.CheckBoxList1.DataTextField = "TypeName";
    this.CheckBoxList1.DataValueField = "TypeId";
    this.CheckBoxList1.DataBind();
   // this.DropDownList2.Items.Insert(0, new ListItem("请选择", "0"));
}


private void Kjxm_Year()//读取类型
{
    string sql1 = "select * from Mir_Type where TypeTitleId=" + 8 + " order by TypeId ";
    DataTable dt = Class1.ExecSel(sql1);
    this.DropDownList1.DataSource = dt;
    this.DropDownList1.DataTextField = "TypeName";
    this.DropDownList1.DataValueField = "TypeId";
    this.DropDownList1.DataBind();
    this.DropDownList1.Items.Insert(0, new ListItem("请选择", "0"));
}


protected void Page_Load(object sender, EventArgs e)
{

    if (!this.IsPostBack)
    {
        this.Kjxm_Big();

        this.Kjxm_Year();

    }
}

private void Kjxm_Add() //添加项目
{

   // Label1.Text = "通过1!";

    string Home_Show,Up_Show;


    //--------------------------
    string Tz_Title = TextBox1.Text.Trim();//机构名称



   string   Tz_Type = DropDownList1.SelectedValue;//机构性质

   string   Tz_TypeTitle = DropDownList1.SelectedItem.Text;

 //  string    SortType = DropDownList2.SelectedValue;
 //  string    SortTypeName = DropDownList2.SelectedItem.Text;

   string save_cblJL = "";//投资类型
   for (int i = 0; i < this.CheckBoxList1.Items.Count; i++)
   {
       if (this.CheckBoxList1.Items[i].Selected == true)
       {
           save_cblJL += this.CheckBoxList1.Items[i].Value + ",";
       }

       else
       {

           Class1.AlertShow("请选择投资类型!");

       }
   }





    string Content = ftbContent.Value.Replace("'", "'");//公司介绍

    //--------------------------

   if (Tz_Title == "")
    {
        Class1.AlertShow("名称不能为空!");
        return;
    }  
   else if (Tz_Title.Length > 100)
    {
        Class1.AlertShow("名称不能大于100个字!");
        return;
    }


   if (this.DropDownList1.SelectedItem.Text == "请选择")
    {
        Class1.AlertShow("请选择投资类型!");
        return;
    }      
    else if (Content == "")
    {
        Class1.AlertShow("公司介绍不能为空!");
        return;
    }







   string  sql = "insert into Tzxmk(TZ_Type,TZ_TypeName,TZ_Title,TZ_Content1)values('" + Tz_Type + "','" + Tz_TypeTitle + "','" + Tz_Title + "','" + Content + "'')";


    Class1.ExecSql(sql);
    Class1.AlertShow("添加成功!", "Kjxm_Edit.aspx?action=add");
}

protected void btn3_Click(object sender, EventArgs e)
{
if (Request.QueryString["action"] == "add")
{

        Kjxm_Add();

    }
    else if (Request.QueryString["action"] == "edit")
    {
      // Kjxm_edit();
    }
}

}

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

4条回答 默认 最新

  • guwei4037 2015-05-19 13:44

    贴的代码真够乱的,设置一个断点,跟踪调试一下程序,看下程序的走向。

    评论
    解决 无用
    打赏 举报
  • threenewbee 2015-05-19 13:53

    你有访问As_Tzxm_Edit.aspx么

    评论
    解决 无用
    打赏 举报
  • ty_zjp 2015-05-19 14:05

    一楼的朋友感觉没有常识,二楼的朋友程序不执行,除了语法检查外!

    评论
    解决 无用
    打赏 举报
  • ty_zjp 2015-05-19 14:15

    VS2008下的,断点不会弄啊!

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题