Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oracle 数据库读取数据null值的问题。如果是string类型,能不能null转成空字符串? #436

Closed
sundayisblue opened this issue Aug 25, 2020 · 2 comments

Comments

@sundayisblue
Copy link

由于oracle数据库特殊性,存入空字符串是null,这样有个问题,我获取数据时候string类型字段获取空字符串都是null,这个null问题会影响我的业务上的代码。我的需求是想寻求全局设置,当取值时候,string为null的字段会变成空字符串。

@2881099
Copy link
Collaborator

2881099 commented Aug 25, 2020

fsql.Aop.AuditDataReader += (_, e) =>
{
    if (e.DataReader.GetFieldType(e.Index) == typeof(string) && e.Value == DBNull.Value)
        e.Value = "";
};

@sundayisblue
Copy link
Author

多谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants