 |
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
|
|
|
|
|

June 15th, 2004, 09:44 PM
|
|
Authorized User
|
|
Join Date: Mar 2004
Posts: 84
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

June 15th, 2004, 10:02 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
Drop the *:
news_recordset.Source = "SELECT tdcdate, tdcmessage FROM news_messages WERE date()% => tdcopendate AND =< tdcclosedate"
HTH,
Snib
<><
|
|

June 16th, 2004, 12:33 AM
|
|
Authorized User
|
|
Join Date: Mar 2004
Posts: 84
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

June 16th, 2004, 02:01 AM
|
|
Friend of Wrox
|
|
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
|
|
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
|
|

June 16th, 2004, 02:07 AM
|
|
Friend of Wrox
|
|
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
|
|
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
|
|

June 16th, 2004, 02:52 AM
|
|
Authorized User
|
|
Join Date: Mar 2004
Posts: 84
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|
|
 |