DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Visual Basic 4 / 5 / 6 (http://www.daniweb.com/forums/forum4.html)
-   -   sql query error (http://www.daniweb.com/forums/thread88025.html)

anto_nee Aug 30th, 2007 6:23 am
sql query error
 
rsYear1.Open "select count(ComplaintNo) from tblcomplaint where year(cDate) ='" + Year(DTPicker1.Value) + "'", ConSQL, adOpenDynamic, adLockOptimistic

hi if u find any fault here

reply me immediately

rsYear1.Open "select ComplaintNo from tblcomplaint where cDate ='" + DTPicker1.Value+ "'", ConSQL, adOpenDynamic, adLockOptimistic

i already try this also

plzzzzzzzzzz

kb.net Aug 30th, 2007 10:37 am
Re: sql query error
 
Hi,

What is the problem you are facing ... As syntax I don't see any mistake. If you are retriving wrong records try to format the value of the date picker.

QVeen72 Aug 31st, 2007 5:26 am
Re: sql query error
 
Hi Anto_nee,

Year(SomeDate) Returns a Numeric value, so, u dont have to wrap it with single quotes.. Check this :

rsYear1.Open "select count(ComplaintNo) from tblcomplaint where year(cDate) =" & Year(DTPicker1.Value) , ConSQL, adOpenDynamic, adLockOptimistic

REgards
Veena

anto_nee Sep 3rd, 2007 4:29 am
Re: sql query error
 
yah fine to all

i found the prob before reach here

Kb.net u r absolutely correct

i just format that date

thanks for the reply


All times are GMT -4. The time now is 4:32 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC