473,765 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

2 Questions. ASP & SQL

Hi All,

Can anyone help.

Q1. How do I send 2 dates to a stored query in access. What I have in the
query so far is

Select * from tblOrders where Date_Archived between #3/01/04# and #3/31/04#

What I want is to send to variables to this query that the user inputs.

Q2. I know that this is probably not the right group but I am trying to
trim a string (first name to 1 letter) in an SQL statement.

Does any one know how to do this? I do not want to use ASP as I will be
build a complete CSV file on the file (column names and data)

I appreicate any help on these matters.

Regards,

Stuart
Jul 19 '05 #1
2 1188
"Stuart" wrote ...
Q1. How do I send 2 dates to a stored query in access. What I have in the query so far is

Select * from tblOrders where Date_Archived between #3/01/04# and #3/31/04#

I'm guessing you already have your sql statement in a string....
strDateOne = "03/01/04"
strDateTwo = "03/31/04"

SQL = "Select * from tblOrders where Date_Archived between #" & strDateOne &
"# and #" & strDateTwo & "#"

You'd obviously want to validate the date entries before doing this...
Q2. I know that this is probably not the right group but I am trying to
trim a string (first name to 1 letter) in an SQL statement.
You mean the results after the query has been executed or actually in the
sql statement?

If the former then...

strInitial = RS("Forename") ' guessing your field names
strInitial = Left(strInitial , 1)
Does any one know how to do this? I do not want to use ASP as I will be
build a complete CSV file on the file (column names and data)


Aha! You want the latter...

SQL = "SELECT Left(Forename, 1) AS Initial FROM your_table"

Hope this helps...

Regards

Rob
Jul 19 '05 #2
Stuart wrote:
Hi All,

Can anyone help.

Q1. How do I send 2 dates to a stored query in access. What I have
in the query so far is

Select * from tblOrders where Date_Archived between #3/01/04# and
#3/31/04#

What I want is to send to variables to this query that the user
inputs.
Great! I am happy to see you are not contemplating using dynamic sql. It is
much more efficient to use a saved query.
The first step is to parameterize this query. Change the sql statement to:

Select <column list> from tblOrders where Date_Archived between [pStart] and
[pEnd]

Save the query as qGetOldOrders. When you test it (what? you weren't
planning to test this in Access? shame :-) - one of the benefits of using
saved queries is that you get to test them in Access before trying to run
them in ASP), you will find that Access will prompt you for values for the
parameters. You will supply those values in your vbscript code.

Note: do not use selstar (select *) in production code: by being lazy, you
make the query engine work harder which is not good if you want an efficient
application

Now, in asp, do this
'create and open a connection called cn, then
set rs=createobject ("adodb.records et")
cn.qGetOldOrder s #2004/03/01#,#2004/03/31#,rs

Your recordset will now be open.

Q2. I know that this is probably not the right group but I am trying
to trim a string (first name to 1 letter) in an SQL statement.


Unrelated questions should be split into separate posts. I'll make an
exception this time and answer it. In the future, please follow the
guideline of one question per post.

You can use the VBA Left() function in a Jet SQL statement:

Select Left(column_nam e,1), etc.

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"
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1524
by: Stefano | last post by:
I would like to get the value of a tag in an xml file, the problem is that, his structure is not <item>value</item> but is: <Cube> - <Cube time="somevalue"> <Cube rate="the value i want to get" /> <Cube rate="the value i want to get" /> <Cube rate="the value i want to get" /> and so on.....
13
1506
by: Randy Webb | last post by:
Just for my own curiosity, what ever happend to the Java Applet that was referenced in the FAQ along with the HTTPRequestObject? http://jibbering.com/faq/#FAQ4_34 And in http://jibbering.com/faq/#FAQ4_43, any chance of adding a snippet about this bookmarklet: ...
8
5261
by: Mike | last post by:
Hello, I have a few rather urgent questions that I hope someone can help with (I need to figure this out prior to a meeting tomorrow.) First, a bit of background: The company I work for is developing a web-based application, one part of which involves allowing the user the ability to page through transaction "history" information. The _summary_ history table will have the following fields: ServiceName, Date, User-Ref1, User-Ref2,...
6
2020
by: John Wells | last post by:
Guys, My boss has been keeping himself busy reading MySQL marketing pubs, and came at me with a few questions this morning regarding PostgreSQL features (we're currently moving to PostgreSQL). While I don't think either are really that important for our situation, he wanted to know specifically whether PostgreSQL supported SQL:2003, and what sort of capabilities PostgreSQL has to scale across multiple CPUs and hosts (multithreading,...
14
5934
by: Arne | last post by:
A lot of Firefox users I know, says they have problems with validation where the ampersand sign has to be written as &amp; to be valid. I don't have Firefox my self and don't wont to install it only because of this, so I hope some of you gurus can enlighten me with this :) In what circumstances can the "&amp;" in the source code be involuntary changed to "&" by a browser when or other software, when editing and uploading the file to the web...
0
4596
by: connectrajesh | last post by:
INTERVIEWINFO.NET http://www.interviewinfo.net FREE WEB SITE AND SERVICE FOR JOB SEEKERS /FRESH GRADUATES NO ADVERTISEMENT
1
1479
by: robertmeyer1 | last post by:
Hi, I have 3 tables set up. tblQuestion, tblAnswer, tblClient. I have them linked together and have a sbf and mainform set up for data entry. The sbf links the questions and answers together. The mainform is based off the tblClients and has the sbf inserted into it. At this point, all the questions from tblQuestions are shown, and tblAnswers have $0.00 (currency fill-in field). SO the questions are all prepopulated with the default...
5
1358
by: Lloyd Sheen | last post by:
I have a couple of questions about URLs. I have an app which will allow me to access my music collection if I can access the internet. It shows a list of Artists / Genres / Search etc which produces a GridView list of songs each with a "Play" button. All the code works and I can play most of the songs with no problem. It is songs with "special" characters in the filename that cause problems. A single quote in the filename or a "\"...
7
2575
by: tempest | last post by:
Hi all. This is a rather long posting but I have some questions concerning the usage of character entities in XML documents and PCI security compliance. The company I work for is using a third party ecommerce service for hosting its online store. A few months ago this third party commerce site began using PGP file encryption on XML files (e.g. web orders) transferred to us as part of the ongoing PCI security compliance.
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10168
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9837
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8833
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7381
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
3929
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.