【发布时间】:2012-06-12 19:47:41
【问题描述】:
下面的代码是我为在单击按钮时使用 oracle 数据库中的值填充网格视图而编写的。 我面临的问题是,当我手动从“sqlplus”中删除表中的行然后单击按钮时,它仍然显示我之前输入的值而不是空网格。我对 gridview 很陌生,所以请帮帮我
protected void Button1_Click(object sender, EventArgs e)
{
string v =System.Configuration.ConfigurationManager.ConnectionStrings["harish"].ConnectionString;
con = new OracleConnection(v);
con.Open();
cmd = new OracleCommand("select * from leave_module1 order by name", con);
dr = cmd.ExecuteReader();
GridView1.DataSource=dr;
GridView1.DataBind();
con.Close();
dr.Close();
}
【问题讨论】:
-
你在 sqlplus 中提交了更改吗?
-
您是否已对其进行调试以确保查询实际上没有返回任何内容?
-
@nunespascal 我删除了 sqlplus 中的所有行,并用 select 命令检查了它。它没有选择任何行
-
@CodingGorilla:在 sqlplus 中没有返回任何行。
-
@HarishViswanathan 但是你的
OracleCommand真的返回结果了吗?该问题可能与数据网格无关,可能是缓存问题或缺少提交或数据库方面的问题。
标签: c# .net visual-studio-2010 gridview oracle11g