向各位高手请教一个问题,就是我在表示层中开始写了一个窗体加载事件,当窗体生成的时候会从后台数据库把数据读出放到DataGredeView中;之后我又做了一个在文本框中输入要查询信息的类型后,当我点击查询按钮时,把后台数据独到DataGredeView中。可是,问题是当我输入类型之后,DataGredeView控件中却无显示;这个我就不太清楚了。下面是表示层和数据层的代码://表示层using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ShoppingInfo.BLL;namespace ShoppingInfoApplication
{
    public partial class ShoppingInfo : Form
    {
        public ShoppingInfo()
        {
            InitializeComponent();
        }        private void ShoppingInfo_Load(object sender, EventArgs e)
        {
            dataGridView1.DataSource = ShoppingManager.queryShoppingInfoAll();
            dataGridView1.Columns["Id"].HeaderText = "编号";
            dataGridView1.Columns["Name"].HeaderText = "商品名";
            dataGridView1.Columns["Type"].HeaderText = "类型";
            dataGridView1.Columns["Number"].HeaderText = "数量";
            dataGridView1.Columns["Price"].HeaderText = "价格";        }        private void btnQuery_Click(object sender, EventArgs e)
        {
            MessageBox.Show(this.txtType.Text);
            dataGridView1.DataSource = ShoppingManager.queryShoppingInfoByType(this.txtType.Text.Trim());
            
        }
    }
}
//数据层using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ShoppingInfo.Models;
using System.Data;
using System.Data.SqlClient;namespace ShoppingInfo.DAL
{
    public static class ShoppingService
    {
        public static IList<ShoppingInfos> selectShoppingAll()
        {
            IList<ShoppingInfos> siList = new List<ShoppingInfos>();
            string sql = "SELECT * FROM shoppingInfo ";
            using (DataTable dt = DBHelper.GetDataSet(sql))
            {
                foreach (DataRow row in dt.Rows) 
                {
                    ShoppingInfos sis = new ShoppingInfos();
                    sis.Id = (int)row["id"];
                    sis.Name = (string)row["name"];
                    sis.Type = (string)row["type"];
                    sis.Number = (int)row["number"];
                    sis.Price = (double)row["price"];
                    siList.Add(sis);
                }
            }
            return siList;
        }        public static ShoppingInfos selectShoppingInfoByType(string type)
        {
            ShoppingInfos si = new ShoppingInfos();
            string sql ="SELECT * FROM shoppingInfo WHERE type like '"+type+"'";            using (SqlDataReader objReader = DBHelper.GetDataReader(sql))
            {
                while (objReader.Read())
                {
                    si.Id = (int)objReader["id"];
                    si.Name=(string)objReader["name"];
                    si.Type = (string)objReader["type"];
                    si.Number = (int)objReader["number"];
                    si.Price = (double)objReader["price"];
                }
            }
            return si;
        }
    }
}
请各位高手指教一下!