Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP 3.0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 15th, 2004, 09:44 PM
Authorized User
 
Join Date: Mar 2004
Location: , , .
Posts: 84
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to gmoney060 Send a message via MSN to gmoney060
Default Source Selection

I have a database that displays news from a "Open Date" to a "Close Date". Althought I can not get it to work properly. This is the script that selects the stuff from my database.

news_recordset.Source = "SELECT * tdcdate, tdcmessage FROM news_messages WERE date()% => tdcopendate AND =< tdcclosedate"

Please tell me what is wrong, and if i am doing this right at all....

This is the error i am getting:

Microsoft JET Database Engine error '80040e14'

Syntax error (missing operator) in query expression '* tdcdate'.

/testing/index.asp, line 20


  #2 (permalink)  
Old June 15th, 2004, 10:02 PM
Friend of Wrox
 
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Drop the *:

news_recordset.Source = "SELECT tdcdate, tdcmessage FROM news_messages WERE date()% => tdcopendate AND =< tdcclosedate"

HTH,

Snib

<><
  #3 (permalink)  
Old June 16th, 2004, 12:33 AM
Authorized User
 
Join Date: Mar 2004
Location: , , .
Posts: 84
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to gmoney060 Send a message via MSN to gmoney060
Default

Set news_recordset = Server.CreateObject("ADODB.Recordset")
news_recordset.Source = "SELECT tdcdate, tdcmessage FROM news_messages WERE date()% => tdcopendate AND =< tdcclosedate"
news_recordset.ActiveConnection = objConn
news_recordset.CursorLocation = 2
news_recordset.CursorType = 0
news_recordset.LockType = 1
news_recordset.Open()

now i am getting the error

Microsoft JET Database Engine error '80040e14'

Syntax error in FROM clause.

/admin/index.asp, line 20


  #4 (permalink)  
Old June 16th, 2004, 02:01 AM
Friend of Wrox
Points: 2,473, Level: 20
Points: 2,473, Level: 20 Points: 2,473, Level: 20 Points: 2,473, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2004
Location: India
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

Set news_recordset = Server.CreateObject("ADODB.Recordset")
news_recordset.Source = "SELECT tdcdate, tdcmessage FROM news_messages WHERE date()% => tdcopendate AND =< tdcclosedate"
news_recordset.ActiveConnection = objConn
news_recordset.CursorLocation = 2
news_recordset.CursorType = 0
news_recordset.LockType = 1
news_recordset.Open()



Om Prakash
  #5 (permalink)  
Old June 16th, 2004, 02:07 AM
Friend of Wrox
Points: 2,473, Level: 20
Points: 2,473, Level: 20 Points: 2,473, Level: 20 Points: 2,473, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2004
Location: India
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

Set news_recordset = Server.CreateObject("ADODB.Recordset")
news_recordset.Source = "SELECT tdcdate, tdcmessage FROM news_messages WHERE date()% => tdcopendate AND =< tdcclosedate"
news_recordset.ActiveConnection = objConn
news_recordset.CursorLocation = 2
news_recordset.CursorType = 0
news_recordset.LockType = 1
news_recordset.Open()

I think there is spelling mistake, it shoule be "WHERE" and not "WERE".

If you are using SQL server, then
news_recordset.Source = "SELECT tdcdate, tdcmessage FROM news_messages WHERE getdate() between tdcopendate AND tdcclosedate"

If you are using Ms-Access, then
news_recordset.Source = "SELECT tdcdate, tdcmessage FROM news_messages WHERE date() between tdcopendate AND tdcclosedate"





Om Prakash
  #6 (permalink)  
Old June 16th, 2004, 02:52 AM
Authorized User
 
Join Date: Mar 2004
Location: , , .
Posts: 84
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to gmoney060 Send a message via MSN to gmoney060
Default

I think that worked but, it is like still not working. (I am using MS-Access) This is what I am using now.

<%
Dim objConn
Dim connString
Dim news_recordset
Set objConn = Server.CreateObject("ADODB.Connection")
connString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
            Server.MapPath("/testing/News.mdb")
objConn.Open connString

Set news_recordset = Server.CreateObject("ADODB.Recordset")
news_recordset.Source = "SELECT tdcdate, tdcmessage FROM news_messages WHERE date() between tdcopendate AND tdcclosedate"
news_recordset.ActiveConnection = objConn
news_recordset.CursorLocation = 2
news_recordset.CursorType = 0
news_recordset.LockType = 1
news_recordset.Open()
%>

<% While Not news_recordset.EOF
    Response.Write news_recordset("tdcdate") & ": " & news_recordset("tdcmessage") & "<BR>"
news_recordset.MoveNext
Wend %>

I have 14 rows of data, and it is only showing 1 row, and it is not between the 2 dates. So any sujjestions, or comments would be great.



Similar Threads
Thread Thread Starter Forum Replies Last Post
SOLVED - VBA Help For Row Source and Record Source eusanpe Access VBA 4 May 13th, 2008 11:58 AM
Disable View>Source (disable html source) kazmughal44 HTML Code Clinic 11 December 11th, 2007 11:53 AM
Record selection Rijaz BOOK: Professional Crystal Reports for VS.NET 0 April 24th, 2005 08:59 AM
Date Selection gmoney060 Classic ASP Basics 2 September 3rd, 2004 07:01 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.