开发者

How do I get a dataset result for multiple conditions in C#

开发者 https://www.devze.com 2023-04-06 15:29 出处:网络
I\'m trying to add data to a dataset, but I need to check that my new code won\'t开发者_开发知识库 violate the unique indexes.

I'm trying to add data to a dataset, but I need to check that my new code won't开发者_开发知识库 violate the unique indexes.

We're using the Select method to do this:

if ((((DataRowView)ttTableBindingSource.Current).IsNew
       || ((DataRowView)ttTableBindingSource.Current).IsEdit)
      && bankingDataSet.ttTable.Select("name = '" + tbxName.Text + "'").Length > 0)
        {

That's working fine where the index is unique on name only. However there is another table where the unique index is on name and account.

I'm not sure how to build the syntax for the Select method to handle the 2 fields in one search.

Many thanks

Colin


Select("name = '" + tbxName.Text + "' AND account = '" +tbx.Account +"'")
0

精彩评论

暂无评论...
验证码 换一张
取 消