Google Groups Home
Help | Sign in
Message from discussion Having problems with a date field
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Bob Barrows  
View profile  
 More options Jan 5 2004, 7:54 pm
Newsgroups: microsoft.public.inetserver.asp.db
From: "Bob Barrows" <reb01...@NOyahoo.SPAMcom>
Date: Mon, 5 Jan 2004 19:52:24 -0500
Local: Mon, Jan 5 2004 7:52 pm
Subject: Re: Having problems with a date field

Terry Murray wrote:
> Thank you Bob.  Making the change worked.  I am curious about the
> saved parameter query.  Can you explain what it is and how it works.

Sure. Open your database in Access, go to the Queries tab and create a new
query in Design View. Ordinarily, at this point, you would select your
tables/queries from the dialog and begin creating your query. But in this
case, let's use your existing sql statement. Close the Choose Tables dialog
and switch to SQL View (using the toolbar button, or the right-click menu,
or the View menu)

Copy and paste this sql into the SQL window:

SELECT count(tournId) as duplicates
from tournInfo
where  tournName = [qTournName] and
tournCityName = [qCity] and tournProvId = [qProv]
and tournStartDate = [qStDate] and
tournEndDate = [qEndDate] and tournAddress1 = [qAddr1]
and tournAddress2 = [qAddr2] and tournPCode = [qPCode]
and tournWebEmail = [qEmail] and tournStatus = [qStatus]

Run it to make sure it works. Notice that Access prompts you for the
parameter values. Notice the order in which it prompts for the values: it
should be in the same order in which the paramaters appear in the sql. You
need to supply the values in the same order in your ADO code.

So now you've achieved the first goal of proper query design: build and
debug your queries using the native query tool for your database. Only when
you have the query working in its native environment should you attempt to
run it from an external program.

Save the query as qGetDupCount.

To run this query in vbscript is the height of simplicity (cn is an open
Connection object):
Dim rs, dStart, dEnd
dStart = CDate(request.form("tournStartDate"))
dEnd= CDate(request.form("tournEndDate"))
Set rs=server.createobject("adodb.recordset")
cn.qGetDupCount request.form("tournName"), request.form("city"), _
provId, dStart, dEnd, request.form("address1"), _
request.form("address2"), request.form("pcode"), _
request.form("webemail"), status, rs

You now have an open recordset containing the results returned from the
saved query. If you create a saved query that returns no records, just
eliminate the recordset variable:

cn.qNoRecords parm1, ..., parmN

HTH,
Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google