DataGrid控件中不能显示读入的数据,求帮助
程序代码:
public partial class ReaderInfo : Form { private CurrencyManager cmOrders;//数据导航 public ReaderInfo() { InitializeComponent(); } private void ReaderInfo_Load(object sender, EventArgs e) { sqlDataAdapter1.SelectCommand.Parameters[0].Value = "%%"; sqlDataAdapter1.SelectCommand.Parameters[1].Value = "%%"; sqlDataAdapter1.Fill(dataSet11); //绑定数据导航 cmOrders = (CurrencyManager)BindingContext[dataSet11, "读者信息"]; //为读者类型下拉列表框设置下拉列表 string strConn = "workstation id=localhost;Integrated Security=SSPI;database=libbook"; SqlConnection cn = new SqlConnection(strConn); cn.Open(); SqlCommand cmd = cn.CreateCommand(); = "select distinct 类型 from 读者类型"; SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { cmb2.Items.Add(dr.GetValue(0).ToString().Trim()); } } //----------根据输入的信息,查询读者信息-------- private void button1_Click(object sender, EventArgs e) { sqlDataAdapter1.SelectCommand.Parameters[0].Value = "%%"; sqlDataAdapter1.SelectCommand.Parameters[1].Value = "%%"; if (txt1.Text != "") { sqlDataAdapter1.SelectCommand.Parameters[0].Value = "%" + txt1.Text + "%"; } if (txt2.Text != "") { sqlDataAdapter1.SelectCommand.Parameters[1].Value = "%" + txt2.Text + "%"; } dataSet11.读者信息.Clear(); sqlDataAdapter1.Fill(dataSet11); } }我做一个图书管理系统的课设,想在打开读者信息界面时读入全部数据并显示出来,可以再根据读者编号或者读者姓名进行查询,但是就是打开读者信息界面时不能显示全部数据,在输入读者编号或者读者姓名后查询就可以显示。我不知道哪里错了,应该怎么改呀?