主题:有关数据库问题 ,大虾们进来帮忙下。。
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"].[color=FF0000]Rows[0][0].[/color]ToString().Trim() == "Yes")
{
this.menuitem1.Enabled = true;
}
else
{
this.menuitem1.Enabled = false;
}
帮我看下上面那个数据库语句的问题可以吗。
它搞个内部连接,后面数据填充到底是个什么东西。
所以我就是不懂第0行第0列的数据到底是什么。。。
红色的那个是什么意思啊。
我一开始是定义登录的一个变量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"].[color=FF0000]Rows[0][0].[/color]ToString().Trim() == "Yes")
{
this.menuitem1.Enabled = true;
}
else
{
this.menuitem1.Enabled = false;
}
帮我看下上面那个数据库语句的问题可以吗。
它搞个内部连接,后面数据填充到底是个什么东西。
所以我就是不懂第0行第0列的数据到底是什么。。。