有选择地填充数据集 [英] Selectively filling a dataset

查看:182
本文介绍了有选择地填充数据集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要改变哪些行是由基于几个标志数据库抓起。我怎样才能做到这一点?我现在的code是这样的:

I need to change what rows are grabbed from the database based upon a few flags. How can I do this? My current code is like this:

this.tblTenantTableAdapter.Fill(this.rentalEaseDataSet.tblTenant);

说,如果我想的ID大于50只的行,会怎么做呢?

Say if I wanted only rows that the id was greater than 50, how would I do that?

编辑:

在code来访问数据库自动生成的原始程序员很久以前虽然VisualStudio中。我不知道究竟如何从自动生成的code的连接。如果我能做到,我知道如何使用SqlDataAdapter

The code to access the database was autogenerated by the original programmer a long time ago though VisualStudio. I don't know exactly how to get a connection from the autogenerated code. If I could do that I know how to use the SqlDataAdapter

推荐答案

在您的SQL查询你为什么不使用,其中条款?

Why wouldn't you use a WHERE clause in your SQL query?

另外,我希望你不要用你的 ID 字段,这样的事。如果你只是想在第一个50的选择,您可能需要使用一个 TOP 50 条款或类似的东西。

Also, I would hope you don't use your ID field for anything like this. If you just want the first 50 selections, you may want to use a TOP 50 clause or something similar.

有关如何使用您的TableAdapter做一些信息: HTTP:// WWW。 shiningstar.net/ASPNet_Articles/DataSet/DataSetProject7.aspx

For some info on how to do this with your TableAdapter: http://www.shiningstar.net/ASPNet_Articles/DataSet/DataSetProject7.aspx

这篇关于有选择地填充数据集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆