strange problem with access query and parameter ...

A

Andrew

hi,
here is my code :
szQry = "SELECT SubCategory_ID , " & _
" Loc1.Description as Descrizione " & _
" FROM C_SubCategories " & _
" LEFT OUTER JOIN D_Localizations Loc1 " & _
" ON ( C_SubCategories.Description_ID = Loc1.Localization_ID
AND Loc1.Language_ID = @LanguageID ) " & _
" WHERE Category_ID = @CategoryID " & _
" AND StateActive = 1 " & _
" ORDER BY SubCatOrder "

now i set the szqry to the command and i set the parameter ....
if set first the @languageID paramater and then the @CategoryID then command
returns always 0 record.
but if i change the order and put first the @CategoryID and the @languageID
all work great !!!! Why ?
Does Access convert my query ? It's a problem of the outer join ????
very strange .......

any suggestion?
tnx in advance
andrew


acc
 
V

Val Mazur

Hi Andrew,

It should work, but I believe you cannot use named parameters with any
provider except OLEDB .NET for SQL Server. Try to replace named parameters
with the question marks and see if it helps. Your query should look like

szQry = "SELECT SubCategory_ID , " & _
" Loc1.Description as Descrizione " & _
" FROM C_SubCategories " & _
" LEFT OUTER JOIN D_Localizations Loc1 " & _
" ON C_SubCategories.Description_ID = Loc1.Localization_ID
AND Loc1.Language_ID = ?" & _
" WHERE Category_ID = ? " & _
" AND StateActive = 1 " & _
" ORDER BY SubCatOrder "
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top