31,login文件不能出现在框架内部,所以要在body中加入:
<body onload="javascript:if(window.location!=top.location)top.location=window.location;">
就可以解决这个问题
32,这样做可以在 sql里写入null:
insert into stukcb(kechengming, ...) values(null,..)
或着越过该列
update stukcb set kechengming=null
33,大表大表,接连的项目都是大表的架构,界面编程读写变得异常繁琐,于是决定动态生成所有列和选项
Literal和panle成为最好的搭档,只是关于验证的部分还有待于进一步的研究
string connectionstring = ConfigurationManager.AppSettings.Get("mydatabase");
string myselect = "SELECT * from T_UIcfg where groupname='" + Session["groupname"].ToString().Trim ()+"'";
SqlCommand thiscommand = new SqlCommand(myselect);
thiscommand.Connection = new SqlConnection(connectionstring);
SqlDataAdapter myDataAdapter = new SqlDataAdapter(myselect, connectionstring);
thiscommand.Connection.Open();
DataSet MyDataSet = new DataSet();
myDataAdapter.Fill(MyDataSet, "T_user");
thiscommand.Connection.Close();
//建立控件
int j = 1;
Panel1.Controls.Add(new LiteralControl("<table width=100% border=0 cellspacing=1 cellpadding=0><tr>"));
for (int i = 3; i <= MyDataSet.Tables[0].Columns.Count - 1; i++)
{
if (MyDataSet.Tables["T_user"].Rows[0][i].ToString().Trim () != "-1")
{
Panel1.Controls.Add(new LiteralControl("<td>"));
CheckBox chk_my = new CheckBox();
chk_my.Checked = false;
if(MyDataSet.Tables[0].Rows[0][i].ToString().Trim () =="1")
chk_my.Checked = true;
chk_my.Text = MyDataSet.Tables[0].Columns[i].ToString ();
chk_my.Text = chk_my.Text.Substring(3);
chk_my.ID = "chk_my" + i;
Panel1.Controls.Add(chk_my);
Panel1.Controls.Add(new LiteralControl("</td>"));
if(j%4==0)
Panel1.Controls.Add(new LiteralControl("</tr><tr>"));
j++;
}
}
Panel1.Controls.Add(new LiteralControl("</table>"));