|
-
Dec 19th, 2006, 06:25 AM
#1
Thread Starter
Fanatic Member
[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
If your problem has been solved then please mark the thread [RESOLVED].
If i have helped then please Rate my post 
-
Dec 19th, 2006, 06:34 AM
#2
Lively Member
Re: Problem with SQL statement
It depends on the database use, some database use % and some use * as wildcard.
-
Dec 19th, 2006, 06:35 AM
#3
Thread Starter
Fanatic Member
Re: Problem with SQL statement
Ok....didn't know that...i'll try it and let you know.
Thanks
If your problem has been solved then please mark the thread [RESOLVED].
If i have helped then please Rate my post 
-
Dec 19th, 2006, 06:41 AM
#4
Thread Starter
Fanatic Member
Re: Problem with SQL statement
No it still returns 0 all the time!
If your problem has been solved then please mark the thread [RESOLVED].
If i have helped then please Rate my post 
-
Dec 19th, 2006, 07:08 AM
#5
Thread Starter
Fanatic Member
Re: Problem with SQL statement
Managed to fix it.
Thanks for your help though. 
If your problem has been solved then please mark the thread [RESOLVED].
If i have helped then please Rate my post 
-
Dec 19th, 2006, 08:12 AM
#6
PowerPoster
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.
-
Dec 19th, 2006, 08:20 AM
#7
Thread Starter
Fanatic Member
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.
If your problem has been solved then please mark the thread [RESOLVED].
If i have helped then please Rate my post 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|