// 查询信息-模糊查询 private void button1_Click(object sender, EventArgs e) { string code = textBox1.Text.Trim(); string name = textBox2.Text.Trim(); int type = Convert.ToInt32(comboBox1.SelectedValue.ToString()); SupermarketEntities2 db = new SupermarketEntities2(); var query = from g in db.goods where g.货物代码.Contains(code) && g.货物名称.Contains(name) && g.类型 == type select new { g.货物代码, g.货物名称, g.单位, g.库存量, 类型 = g.types.name, 供应商 = g.supplier.name, g.入库单号, g.入库日期, g.售价 }; dataGridView1.DataSource = query.ToList(); }
public static int select(string name, string password) { using (SupermarketEntities2 db = new SupermarketEntities2()) { //定义一个输出参数 ObjectParameter paral = new ObjectParameter("result", typeof(int)); //调用一下存储过程 var result = db.prcValiddateUser(name, password, paral); //返回结果 return((int)paral.Value); } }