954,202 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

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

anto_nee
Junior Poster in Training
76 posts since Aug 2007
Reputation Points: 12
Solved Threads: 4
 

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.

kb.net
Junior Poster
172 posts since Aug 2007
Reputation Points: 13
Solved Threads: 29
 

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

QVeen72
Posting Shark
950 posts since Nov 2006
Reputation Points: 84
Solved Threads: 143
 

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

anto_nee
Junior Poster in Training
76 posts since Aug 2007
Reputation Points: 12
Solved Threads: 4
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You