Check Recordset Against Current Month

# Thread: Check Recordset Against Current Month

1. Senior Member
Join Date
Dec 1969
Posts
131

## Check Recordset Against Current Month

I want to display data, for one record, on a web page and I am checking for the &#039;displayflag&#039; equal to 1. Once I have more that two months worth of data, which for this page is two records, I want to only display the current months data. The column for month is called &#039;mnth&#039;, how do I include this into my sql statement to check for displayflag = 1 and the current month?<BR>sql = "select * from tblPOM where displayflag = 1"<BR><BR>Thanks.

2. God
Senior Member
Join Date
Dec 1969
Posts
18,177

## .. displayflag = 1 and mnth = x (eop)

.

3. Senior Member
Join Date
Dec 1969
Posts
131

## RE: .. displayflag = 1 and mnth = x (eop)

What does &#039;x (eop)&#039; mean or represent?<BR><BR>Thanks.

4. Senior Member
Join Date
Dec 1969
Posts
11,247

## RE: .. displayflag = 1 and mnth = x (eop)

Basic mathmatic notation x is the unknown value === replace with what you want<BR><BR>(eop) === end of post, No more in the post, the post is ended, dead it is not more

5. Senior Member
Join Date
Dec 1969
Posts
131

## RE: .. displayflag = 1 and mnth = x (eop)

Gotcha, Thanks!

6. Senior Member
Join Date
Dec 1969
Posts
131

## Ok, now I get this error..........................

Ok, I have defined my variable &#039;x&#039; and used it in the following:<BR>&#060;%<BR>&#039;&#039;get all information for the POM this month<BR>ThisMonth = month(date())<BR>sql = "select * from tblPOM where displayflag = 1 and mnth = " & ThisMonth & ""<BR>set rsPOM = db.execute(sql)<BR>%&#062;<BR><BR>Table column &#039;mnth&#039; is data type varchar.<BR><BR>When I go to bring up the page, I get the following error message:<BR><BR>&#039;Microsoft OLE DB Provider for ODBC Drivers error &#039;80040e07&#039; <BR>[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the varchar value &#039;May&#039; to a column of data type int.&#039;<BR><BR>Do I need to change column&#039;s &#039;mnth&#039; data type to &#039;int&#039; in order to use the month function in my query? <BR>

7. Senior Member
Join Date
Dec 1969
Posts
11,247

## RE: Ok, now I get this error......................

No you need to change your code slightly<BR><BR>sql = "select * from tblPOM where displayflag = 1 and mnth = &#039;" & MonthName(ThisMonth) & "&#039;"

8. Senior Member
Join Date
Dec 1969
Posts
131

## RE: Ok, now I get this error......................

That fixed it, thanks again for the help.<BR><BR>BTW, do you have any suggestions for a comprehensive Classic ASP book(s). I know ASP.Net is the latest, but I would like to have a good understanding of classic ASP before moving to dot Net.

9. Senior Member
Join Date
Dec 1969
Posts
16,931

## RE: Ok, now I get this error......................

I would like to have a good understanding of classic ASP before moving to dot Net<BR><BR>Seriously, if you&#039;re starting from scratch then I don&#039;t know that it&#039;s worth it. ASP.NET moves the goalposts so drastically that I wouldn&#039;t confuse yourself.<BR><BR>Craig.

10. Senior Member
Join Date
Dec 1969
Posts
11,247

## RE: Ok, now I get this error......................

Personally I have not read a book on ASP I use the articles on here and other like sites<BR><BR>Oh and ASP (classic) and .NET are a push bike vs a motor car<BR><BR>So learning one does not mean you&#039;ll have understanding of the other

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•