SqlDataAdapter da = new SqlDataAdapter("select * from one where id="+id, con); 我就是搞不懂 第二个id错误,(提示说上下文不存在名称id)这个id是 数据库里id啊,为什么提示错误呢?id是数据库的id,但是你在使用这条sql语句之前,需要定义这个id啊 比如 string id=3; 然后就是你的 SqlDataAdapter da = new SqlDataAdapter("select * from one where id="+id, con); 后面这个id是个变量。。。 你没有ID这个变量!
定义一个! int Id=1; SqlDataAdapter da = new SqlDataAdapter("select * from one where id="+id, con);
比如说应该有个方法吧 例如: public Ilist <product> GetproductById(int id){ SqlDataAdapter da = new SqlDataAdapter("select * from one where id="+id, con); } 后面得Id事在方法里面来得知道了吗 ??? 你要给这个ID赋值才行啊。 随便定义一个int id=1 或 int id= Convert.ToInt32(Request["id"]);//取值 难道是传说中的没有声明变量ID 都说得不错,我就不多分析了,LZ头像MM不错,5楼的用户名很猛 这个Id不凭空捏造的吧 来晚了 后面那个 +id 是一个变量,要在前面先定义! 估计后面那个ID 没有赋值~ 第一,你后面的那个变量ID 没有定义, 第二,变量ID和你的数据库里的ID不能一样,
select top 12 * from Product where [id] not in (select top 12 [id] from Product) 这样可以分页,但是我在后面想加个条件 select top 12 * from Product where [id] not in (select top 12 [id] from Prod ......