如何显示查找(DB)中不存在的值? [英] How to Display Values not exist on Lookup(DB)?

查看:40
本文介绍了如何显示查找(DB)中不存在的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 PartNumbers Loaded :
                     P0001        - Not on DB
                     P0002        - Not on DB
                     P0003        - On DB
                     P0004        - On DB

<小时>

代码:

     int i = 0;
        //Loop Records per Row
        foreach (var serverA in load)
        {

              var obj = new Bal();
              var ent = new Entity
                      {
                      PartNumber = serverA.PartNumber.ToString()
                      };


                      _dSet = obj.SelectPartNumber(ent);

                     //CHECK IF PART NUMBER EXIST ON DB
                     if (_dSet.Tables[0].Rows.Count > 0)
                         {

                         }
                         else
                         {
                            i++; //Count Part Numbers not exist on  DB
                         }

       }
    lblStatus.Text = i > 0 ? @"PartNumbers not on DB" : @"Data has been Loaded";

在此代码中:( i ) 值等于 2 并且不在 DB 上显示零件编号.

In this Code:( i ) value is equal to 2 and Display PartNumbers not on DB.

我的问题是如何显示数据库中不存在的部件号并将其显示在任何容器上(消息框蚀刻.).

My Problem is how can i display the part numbers that do not exist on DB and display it on any container(Message Box etch.).

Ex:
    PartNumber Not on DB
           P0001
           P0002

谢谢!

推荐答案

在增加计数的地方,您可能希望将零件编号添加到列表中.然后,您可以使用该列表生成要显示的文本.使用 StringBuilder 而不是列表可能也可以正常工作.

Where you're incrementing the count you probably want to add the part number to a list. you can then use the list to generate the text to display. Using a StringBuilder instead of a list would probably work okay, too.

这篇关于如何显示查找(DB)中不存在的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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