Solved

Visual Studio Visual Basic Select Statement

Posted on 2007-03-22
4
209 Views
Last Modified: 2013-11-26
Hello All,

               Have this line of code below

Dim strSql As String = "SELECT Sum(fromadvtodaytxt) FROM Settlement Where SettlementDatetxt is not null and (CONVERT(Char(6), SettlementDatetxt, 112) = CONVERT(Char(6), GETDATE(), 112))"

Needing to add where it also checks the current year-if you can help?

Thanks JK
0
Comment
Question by:fsuedu
  • 3
4 Comments
 
LVL 21

Expert Comment

by:theGhost_k8
ID: 18771609
try this convert(varchar(4), datepart(year, getdate()))
0
 

Author Comment

by:fsuedu
ID: 18771856
Getting a syntax error

can you see whats wrong?

SELECT Sum(fromadvtodaytxt) FROM Settlement Where SettlementDatetxt is not null and (CONVERT(Char(6), SettlementDatetxt, 112) = CONVERT(Char(6), GETDATE(), 112)) and (CONVERT(varChar(4), SettlementDatetxt, 112)convert(varchar(4), datepart(year, getdate())))"

Thanks JK
0
 
LVL 21

Expert Comment

by:theGhost_k8
ID: 18771874
xt, 112)convert(va
            /\
no space??
0
 
LVL 21

Accepted Solution

by:
theGhost_k8 earned 500 total points
ID: 18771881
=
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now