工业侠客 2017-04-21 06:20 采纳率: 0%
浏览 980
已结题

为什么SQL数据库里删除了的数据在VS2010运行时gridview还能显示出来?求解决方法

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 admin : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
GridView1.DataBind(); //设置GridView1的数据源
DataBind(); //进行绑定
}
protected void InsertButton_Click(object sender, EventArgs e)
{

     }

protected void Button1_Click(object sender, EventArgs e)
{
string a=System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(TextBox4.Text.ToString(),"MD5");
string username,password,sql;
username=TextBox3.Text;
password=a ;
sql="insert into UserInfo(username,password) values('"+username+"','"+password +"')";
SqlConnection con = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
SqlCommand com=new SqlCommand (sql,con);
com.Connection.Open();
com.ExecuteNonQuery();
GridView1.DataBind();
DataBind();

TextBox3.Text = "";
TextBox4.Text = "";
Response.Write("&quot;);<br> Response.Write(&quot;alert(&#39;添加成功!&#39;);");

}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{

}
}

  • 写回答

2条回答 默认 最新

  • shen_wei 2017-04-21 07:39
    关注

    先清理工程,在重新编译工程。。。。。

    评论

报告相同问题?

悬赏问题

  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记