业务逻辑设定新标准 [英] Business Logic Set New Criteria

查看:81
本文介绍了业务逻辑设定新标准的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个代码可以添加和更新记录到数据库中。所有的数据库和代码都已完成但是有一个问题是我需要分配

I have a code that can add and update record into database.All the database and code had been done but there is a problem is i need to assign the

row.gen_modifyUser = SYSTEM_USER_LOGIN.UserName;
row.gen_entryUser = SYSTEM_USER_LOGIN.UserName;

代码变为非空。

这是我的业务逻辑代码:

in business Logic layer with the code become not null.
Here is my business logic code:

public static bool TMS_GET_PROXIMITY_VALID_TO_USE(string s_proximityNumber)
        {
            bool b_valid = true;
            using (TMPB_attn_DAL dalTMPB_attn = new TMPB_attn_DAL())
            {
               dalTMPB_attn.SetNewCriteria("gen_modifyUser", s_proximityNumber != null);
               dalTMPB_attn.SetNewCriteria("gen_entryUser", s_proximityNumber != null);
               return b_valid;
            }
        }



我设置了gen_modifyUser和gen_entryUser等于not null但它不起作用!!!它会弹出错误对象引用没有设置为对象的实例

有谁可以帮我弄清楚我做错了什么?


I had set the gen_modifyUser and gen_entryUser equal to not null but it doesn't work!!!It will pop out the error object reference not set to an instance of an object
can anyone help me figure out where i had done wrong?

推荐答案

所以使用调试器。

在调试器中运行你的代码,并等到异常发生 - 在这种情况下,调试器将在导致问题的行上停止 - 或者在相关方法的顶部放置一个断点并等待直到调试器命中它。



在任何一种情况下,你都可以检查你的变量,找出哪一个是null并导致问题(任何试图访问属性,空值的字段或方法将给你这个例外),然后回顾你的代码,找出为什么没有有效的值。



我们不能为你做到这一点:请记住,我们无法看到你的屏幕,访问你的硬盘或阅读你的想法,所以我们可以;运行你的代码,找出问题所在!
So use the debugger.
Run your code in the debugger, and either wait until the exception happens - in which case the debugger will stop on the line causing the problem - or put a breakpoint at teh top of the relevant method and wait until the debugger hits it.

In either case, you can then examine your variables to find out which one is null and causing the problem (any attempt to access a property, field or method of a null value will give you this exception) and then look back through you code to work out why is does not have a valid value.

We can't do that for you: Remember that we can't see your screen, access your HDD, or read your mind, so we can;t run your code and find out what the problem is!


这篇关于业务逻辑设定新标准的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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