我有這樣的:爲什麼生成的查詢不同?
Dim compareAddress1 = (From d In db.Addresses Where d.Address1.Equals("a") And _
d.Address2.Equals(Nothing) And _
d.City.Equals(Nothing) And _
d.POBox.Equals(Nothing) And _
d.PostalCode.Equals(Nothing) And _
d.ZipCode.Equals(Nothing))
Dim compareAddress2 = (From d In db.Addresses Where _
d.Address1.Equals(_address.Address1) And _
d.Address2.Equals(_address.Address2) And _
d.City.Equals(_address.City) And _
d.POBox.Equals(_address.POBox) And _
d.PostalCode.Equals(_address.PostalCode) And _
d.ZipCode.Equals(_address.ZipCode))
的對象_address所有領域都爲空。
當我使用的對象,我得到這個查詢:
SELECT [t0].[AddressID], [t0].[Address1], [t0].[Address2], [t0].[City], [t0].[CountryProvinceID], [t0].[POBox], [t0].[PostalCode], [t0].[ZipCode]
FROM [dbo].[Address] AS [t0]
WHERE ([t0].[Address1] = @p0) AND ([t0].[Address2] = @p1) AND ([t0].[City] = @p2) AND ([t0].[POBox] = @p3) AND ([t0].[PostalCode] = @p4) AND ([t0].[ZipCode] = @p5)
-------------------------------
@p0 [AnsiString]: a
@p1 [AnsiString]:
@p2 [AnsiString]:
@p3 [AnsiString]:
@p4 [AnsiString]:
@p5 [AnsiString]:
當我硬編碼數據,我得到這個查詢:
SELECT [t0].[AddressID], [t0].[Address1], [t0].[Address2], [t0].[City], [t0].[CountryProvinceID], [t0].[POBox], [t0].[PostalCode], [t0].[ZipCode]
FROM [dbo].[Address] AS [t0]
WHERE ([t0].[Address1] = @p0) AND ([t0].[Address2] IS NULL) AND ([t0].[City] IS NULL) AND ([t0].[POBox] IS NULL) AND ([t0].[PostalCode] IS NULL) AND ([t0].[ZipCode] IS NULL)
-------------------------------
@p0 [AnsiString]: a
人知道爲什麼嗎?以及如何解決我的問題?
似乎不工作,我怎麼知道如果DLL加載? – Fredou 2009-08-12 15:32:46
對我來說工作得很好。你有什麼問題? – 2009-08-12 15:41:53