有选择地填充数据集数据

2023-09-07 10:43:24 作者:吃不饱

我需要改变哪些行是由基于几个标志数据库抓起。我怎样才能做到这一点?我现在的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

 
精彩推荐
图片推荐