[求助]有关从数据库中读取数据问题
SqlConnection connection = new SqlConnection("server=4F141ACC49A245D;uid=sa;pwd=sa;database=BCLP");connection.Open();
SqlCommand command = new SqlCommand();
command.Connection = connection;
command.CommandType = CommandType.StoredProcedure;
command.CommandText = "p_Right";
SqlParameter para = new SqlParameter("@ID", SqlDbType.VarChar);
para.Value =frmland .strID ;
command.Parameters.Add(para);
SqlDataReader reader = command.ExecuteReader();
TreeNode bank = new TreeNode("银行信用贷款平台");
tvwbank.Nodes.Add(bank);
TreeNode Info = new TreeNode("信息维护");
bank.Nodes.Add(Info);
TreeNode system = new TreeNode("系统管理");
bank.Nodes.Add(system);
TreeNode help = new TreeNode("帮助");
bank.Nodes.Add(help);
while (reader.Read() == true)
{
//MessageBox.Show(reader .GetValue (0).ToString ());
if(reader.GetValue(0).ToString()=="1000" )
{
TreeNode tr = new TreeNode(reader.GetValue(1).ToString());
Info.Nodes.Add(tr);
}
if(reader.GetValue(0).ToString()== "2000")
{
TreeNode tr = new TreeNode(reader.GetValue(1).ToString());
system.Nodes.Add(tr);
}
if(reader.GetValue(0).ToString()== "6000")
{
TreeNode tr = new TreeNode(reader.GetValue(1).ToString());
help.Nodes.Add(tr);
}
}
connection.Close();
}
请问我怎么用messagebox可以显示出1000,2000,6000怎么不进if运行呀