C# 数据库问题。。。。
红色的那个是什么意思啊。我一开始是定义登录的一个变量LoginName;
我也莫名奇妙,大家有更简单的获取登陆名的方法吗。。
SqlConnection thisconnection = new SqlConnection(@"data source=(local);
integrated security=sspi;"+"initial catalog=student");
thisconnection.Open();
string sql = "select roleauthority1,roleauthority2,roleauthority3,roleauthority4,roleauthority5,roleauthority6 from role_table inner join user_table on role_table.rolename = user_table.rolename where user_table.username = '" + LoginName + "' ";
SqlDataAdapter thisadpater = new SqlDataAdapter(sql, thisconnection);
DataSet thisdataset = new DataSet();
thisadpater.Fill(thisdataset,"role_userinfo");
if (thisdataset.Tables["role_userinfo"].Rows[0][0].ToString().Trim() == "Yes")
{
this.menuitem1.Enabled = true;
}
else
{
this.menuitem1.Enabled = false;
}