提问!问判断语字句!新手问题!
求一条判断语句!我用DataGrid绑定然后做了个“数据修改”的链接是超级连接列!进入一个详细显示的页面进行修改!我想判断一下如果数据库内没有详细信息就直接重新定向到出错页面!
代码如下:
private void Page_Load(object sender, System.EventArgs e)
{
par_id.Text = Request.QueryString["cheID"].ToString();
string AutoID = String.Empty;
string cheID = String.Empty;
cheID = Request.QueryString["cheID"].ToString();
AutoID = cheID;
if(!IsPostBack)
{
SqlConnection con = DataCon.AutoCon();
con.Open();
SqlDataAdapter sdz = new SqlDataAdapter("cheParameter_GetList " + AutoID,con);
DataTable dt = new DataTable();
sdz.Fill(dt);
if(dt.Rows.Count == 0) return;
this.par_id.Text = dt.Rows[0]["AutoID"].ToString();
this.par_lhb.Text = dt.Rows[0]["AutoYear"].ToString();
this.par_1.Text = dt.Rows[0]["AutoCheShu"].ToString();
this.par_2.Text = dt.Rows[0]["Auto100js"].ToString();
this.par_3.Text = dt.Rows[0]["Auto100zd"].ToString();
this.par_4.Text = dt.Rows[0]["Auto100jj"].ToString();
this.par_5.Text = dt.Rows[0]["AutoChang"].ToString();
this.par_6.Text = dt.Rows[0]["AutoKuan"].ToString();
this.par_7.Text = dt.Rows[0]["AutoGao"].ToString();
this.par_8.Text = dt.Rows[0]["AutoWeight"].ToString();
this.par_9.Text = dt.Rows[0]["Autozouju"].ToString();
this.par_10.Text = dt.Rows[0]["AutoQlj"].ToString();
this.par_11.Text = dt.Rows[0]["AutoHlj"].ToString();
this.par_12.Text = dt.Rows[0]["Autoldjs"].ToString();
this.par_13.Text = dt.Rows[0]["Autojg"].ToString();
this.par_14.Text = dt.Rows[0]["Autocms"].ToString();
con.Close();
}
}
--------------------编程问答-------------------- 顶! --------------------编程问答-------------------- 顶! --------------------编程问答-------------------- ding! --------------------编程问答-------------------- if(dt.Rows.Count == 0)
{
response.Redirect(@"your url");
return ;
}
*****************************************************************************
欢迎使用CSDN论坛专用阅读器 : CSDN Reader(附全部源代码)
最新版本:20070212
http://www.cnblogs.com/feiyun0112/archive/2006/09/20/509783.html --------------------编程问答-------------------- 顶!! --------------------编程问答-------------------- 学习~ --------------------编程问答-------------------- up
补充:.NET技术 , ASP.NET