如何将其写入linq并以字符串形式存储 [英] How to write this into linq and store in string
本文介绍了如何将其写入linq并以字符串形式存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将此写入linq并以strin存储
从loginusers中选择typeid,其中username =''Admin''
以及如何存储在字符串
解决方案
var id =( 来自 x loginusers
其中 x.username == Admin
选择 x.typeid)。单();
或
var id =(来自 x loginusers
其中 x.username == Admin
选择 x.typeid).FirstOrDefault( 0 跨度>);
How to write this into linq and store in strin
select typeid from loginusers where username=''Admin''
and how to store in string
解决方案
var id = (from x in loginusers where x.username == "Admin" select x.typeid).Single();
OR
var id = (from x in loginusers where x.username == "Admin" select x.typeid).FirstOrDefault(0);
这篇关于如何将其写入linq并以字符串形式存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文