Strange Behavior between Access Query Builder and OledbCommand execution

V

VR

Hi,

I have a table structure like this:

ScreenShots
-------------
Code Active
1 True
2 False

ScreenShotsImages
--------------------
Code Image
1 img1.jpg
2 img2.jpg

ScreenShotsTexts
------------------------
Code Text Culture
1 bla,bla en
1 bla,bla pt

When I build a query using Access tools everything goes fine, but when I set
my oleDbCommand.CommandText property to this query and execute the command I
get "System.NullReferenceException: Object reference not set to an instance
of an object" exception.

The query is:

Access
-------
SELECT ScreenShots.Code,ScreenShotsImages.Image,ScreenShotsTexts.Text
FROM (ScreenShots
INNER JOIN ScreenShotsImagens
ON ScreenShotsImages.Code = ScreenShots.Code)
LEFT JOIN ScreenShotsTexts
ON (ScreenShotsTexts.Code = ScreenShots.Code AND
ScreenShotsTexts.Culture = "en" AND
ScreenShots.Active = true)
ORDER BY ScreenShots.Code

OleDbCommand
-----------
SELECT ScreenShots.Code,ScreenShotsImages.Image,ScreenShotsTexts.Text
FROM (ScreenShots
INNER JOIN ScreenShotsImagens
ON ScreenShotsImages.Code = ScreenShots.Code)
LEFT JOIN ScreenShotsTexts
ON (ScreenShotsTexts.Code = ScreenShots.Code AND
ScreenShotsTexts.Culture = @Culture AND
ScreenShots.Active = true)
ORDER BY ScreenShots.Code

PS: I setup and added the oledbParameter (@Culture) to the command's
parameters collection and I checked: it's there with the correct value

Is there something I'm missing?


Thanks a lot,
Regards,
Victor Reboucas
 
Top