如果我在c#下运行
from p in Addresses where p.Address2 == null select p.AddressID
Run Code Online (Sandbox Code Playgroud)
它会生成此查询
SELECT [t0].[AddressID]
FROM [dbo].[Address] AS [t0]
WHERE [t0].[Address2] IS NULL
Run Code Online (Sandbox Code Playgroud)
如果我在vb.net下运行它
from p in Addresses where p.Address2 = nothing select p.AddressID
Run Code Online (Sandbox Code Playgroud)
它会生成此查询
SELECT [t0].[AddressID]
FROM [dbo].[Address] AS [t0]
WHERE [t0].[Address2] = ''
Run Code Online (Sandbox Code Playgroud)
p.Address2是一个接受空值的varchar字段
为什么vb.net是"错误的"?
在VB中,使用"is"关键字控制空检查.
试试这个;
from p in Addresses where p.Address2 is nothing select p.AddressID
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
78 次 |
| 最近记录: |