[RESOLVED] Problem with SQL statement
Hi guys,
(Using .net cf 2.0)
I have the following sql statement:
VB Code:
With sqlCmd
.CommandText = "SELECT count(*) FROM photos WHERE photoLocation LIKE '" & H42_PHOTO_DIRECTORY & "%'"
'.Parameters.Add(New SqlCeParameter("@photoLocation", H42_PHOTO_DIRECTORY & "%"))
Dim assigned As Integer = .ExecuteScalar
MsgBox(assigned)
'.Parameters.Clear()
End With
But it always returns 0 when i know that it shouldn't
(by the way H42_PHOTO_LOCATION is a folder on my Pocket PC.) I need it if possible to be done using parameters. Can anybody tell me why this isn't working?
Thanks in advance for any help
:afrog:
Re: Problem with SQL statement
It depends on the database use, some database use % and some use * as wildcard.
Re: Problem with SQL statement
Ok....didn't know that...i'll try it and let you know.
Thanks
Re: Problem with SQL statement
No it still returns 0 all the time!
Re: Problem with SQL statement
Managed to fix it.
Thanks for your help though. :thumb:
:wave:
Re: [RESOLVED] Problem with SQL statement
You should post your fix to the problem so anyone else facing the same issues can find it with a search.
Re: [RESOLVED] Problem with SQL statement
There wasn't a problem with the code....i found out that i guy i'm working on this project with (who isn't in work today) changed the folder and the text in photoLocation....so i was searching using the wrong comparison.