日期:2014-05-18 浏览次数:20831 次
public static DataSet Search(Entity.WeaponInfo Search) { SqlConnection conn = new SqlConnection("Server=.; Integrated Security=True; Database=WeaponSalesMng"); SqlCommand cmd = new SqlCommand("select * from WeapInfo where WeapName=@WeapName", conn); cmd.Parameters.Add(new SqlParameter("@WeapName", Search.Name)); conn.Open(); DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter(cmd.CommandText, conn); da.Fill(ds,"WeapInfo");//在这里提示必须声明标量变量@WeapName da.FillSchema(ds, SchemaType.Source, "WeapInfo"); DataTable table = ds.Tables["WeapInfo"]; conn.Close(); return ds; }