Insert Dates In Sql Query And Other Variables.

Here is my delima im hoping you can help me with. My code currently works fine. However I want to make some modifications to it to get that best possible outcome for my client(Taxi company). Here is the code logic:

The code code currently has one text field which takes a number(Taxi number) and returns all calls assigned to the taxi number inputed in the text field and returns all, canceled, and pickedup calls by said taxi number within the CURRENT DAY. Im trying to find out how i can input a taxi number and get returned calls from PREVIOUS DAYS also preferablly going back one WEEK to a MONTH. I hope im clear. If not please inquire for further clarification.

Heres my actual code:

View Replies


ADVERTISEMENT

Dates In Sql Query And Other Variables.

My code currently works fine. However I want to make some modifications to it to get that best possible outcome for my client(Taxi company). Here is the code logic:

The code code currently has one text field which takes a number(Taxi number) and returns all calls assigned to the taxi number inputed in the text field and returns all, canceled, and pickedup calls by said taxi number within the CURRENT DAY.

Im trying to find out how i can input a taxi number and get returned calls from PREVIOUS DAYS also preferablly going back one WEEK to a MONTH. I hope im clear. If not please inquire for further clarification. Code:

View Replies View Related

SQL Query Not Returning Results In Access For Dates

I am trying to search through an access database for tickets createded with in a certin date. I am using the below code.

strdate = DateAdd("d", -2, Now())
sqlstr="SELECT * FROM Incidents WHERE TicketDate BETWEEN #"& Now() &"# AND #"& strdate &"# ;"

I verify the query with response.write and get the following.

SELECT * FROM Incidents WHERE TicketDate BETWEEN #15/07/04 19:19:32# AND #13/07/04 19:19:32# ;

I know there are 100% tickets within this date. Yet my query returns nuthing. Please help i've searched this forum for other peoples code looking for examples but end up with the same result.

View Replies View Related

INSERT Query

I want to insert 2 values in to a database WHERE the userID=1..... The SQL below shows what I have done so far, but I want it to enter these 2 values into the row where userID column equals 1.

SQL_Insert = "INSERT into tblURL (urlName, urlAddress) values ('aaa', 'bbb')" .

View Replies View Related

Which Is Recommended? Insert Query In ASP?

I am reading about 200 records from dbf file in ASP code and inserting into a table. I fetch the records in a recordset and in the recordset loop I have to insert it into the SQL table.

How should I insert the values?

1) Should I use query in ASP page

2) Or call stored procedure (passing each record parameter) for inserting, 200 times in the loop.

Also what type of cursor should be created, Client side or Server side.

View Replies View Related

Insert Query Not Working

I am having a problem getting an insert query to work. Here is the code:

sql="Insert into tblInCart(user, item_number, qty, price, description, taxcode) Values('" & user & "', '" & item & "', " & qty & ", " & prc & ", '" & desc & "', '" & tax & "')"
set rs2 = db2.execute(sql)

This was the error statement:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query.
It points to the "set rs2=db2.execute(sql)" line

The sql statement looks like this: Insert into tblInCart(user, item_number, qty, price, description, taxcode) Values('EXMPLE', '100BLUERASP', 1, 3.99, 'MIX COCKTAIL BLUE RASP', 'N')

The user, item_number, description, and taxcode fields are text, the qty field is integer, and the price field is currency. The rs2 recordset was previously used for a select query, which works fine, but it is closed before this happens.

View Replies View Related

Insert Error In Query

<%

sqlQuery = "INSERT INTO contacts (firstname, lastname, email, department) VALUES (" & contact_first & ", " & contact_last & ", " & contact_email & ", " & contact_department & ")"

connect.Execute sqlQuery

%>

The error I'm getting is

Microsoft VBScript runtime error '800a01a8'

Object required: ''

/ebusiness0405asp/greg/asp/project/adminContactAdded.asp, line 57

Line 57: connect.Execute sqlQuery

Ideas?

View Replies View Related

ASP Variables And INSERT Statement

Can any one tell me what is wrong with this insert statement:

sql = "INSERT INTO Questions (Question,SurveyId,CatId) VALUES ('" & question & "','" & surId & "','" & Sig &"') "

and why when I print it to screen, it shows this:
INSERT INTO Questions (Question,SurveyId,CatId) VALUES 'this si a test','38, 3','');

I have used similar and it works, they are the right values bit wont work..?

View Replies View Related

How Can I Insert Variables Into SQL Server DB

I am trying to insert three variables into my table in my asp program. Can someone please tell me if my syntax us wrong. I keep getting this error:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]Line 3: Incorrect syntax near '&'.

/credFeesEdit10.asp, line 735

Here is my insert statement: Code:

View Replies View Related

Insert Query With Special Characters

I have problem inserting value with special characters such as email address: anne.walker7@btinternet.com
and creditcard:1111 2222 3333 4444 number with spaces inbetween the numbers as these special characters are reserved in MS Access. Any help

email = "anne.walker7@btinternet.com"
cardnumber = "1111 2222 3333 4444"

sql "insert into users (email, cardnumber) " &_
sql = sql & "values ('" & email & "'," cardnumber & ")"

View Replies View Related

Insert Query In Stored Procedure

we have a query in a stored procedure that is called once a form has been submitted which inserts form data into our database. the problem we are having is that when a user refreshes the page , another record is added to the database. a way to prevent this from happening.

View Replies View Related

INSERT Query Code Problem

I have a problem with my INSERT query, I have tblDueDates, tblClient and three main forms.……..but I get errors when trying to insert payments. I have tblClient and tblDueDates and 1.frmDueDates, to insert and display the due dates for the payments ,

2.frmPayDateList in order to display the Due Dates of all clients in a list according to their due dates and 3.frmClientsPayedrecord, to see the payments of each client after the user clicked on the ‘payed’ button on the 2.frmPayDateList form. Form frmDueDates and frmClientsPayrecord are linked to tblDueDates.

But I get an error when clicking on that ‘payed’ button on the frmPayDateList. I use an INSERT query to insert the payments into that one table tblDueDates and also it should avoid duplication with this query and it’s where clause!!!!

View Replies View Related

Updating Via An INSERT Query Controlled By Checkbox

I have a form that if a user selects a certain option from a dropdown list a checkbox will appear. This checkbox references information from another table and then multiplies a figure before it is submitted (well, that's the theory anyway!)

I can't seem to get the multiplier to work. Can someone please give me some advice to this? I've included some simplified code that concentrates on the areas that I'm having difficulty. Code:

View Replies View Related

How To Declare Session Variables And Use In Insert And Update

how to declare session variables and use it in insert and update sql statements... the scenario is I have:

2 html forms
2 ASP FILES

I am able to trap data from the first form into the acces table..but my second form(which is continuation of first form) has a update query....(ie...it shld update the same record the one inserted from the 1st form )..both the forms work on table in access db

its an annonymus...questionnaite...therefore i am not trapping any user name or login id...but the requirement is the survey made shld be unique....as in no user shld be able to answer the questions twice.

View Replies View Related

Variables Of Parameterized Query

I need the variables for parameterized query of ASP for the following SQL variables.

1. bit
2. tinyint
3. smalldatetime

I googled it but couldn't found anything.

View Replies View Related

Syntax On Passing Variables From Email Form To Insert A Database...

I'm having a problem with passing variables inserting to my database. Here's what I'm doing. I have a page where the user selects a team member (this is fine) Once the team member is selected I have the variables on the form send and email to all supervisors and the member selected (this is fine also) BUT, I'm having problems inserting the emailed information to my access 2000 database after is email. Can someone guide me in the right direction.

View Replies View Related

How To Prevent Duplicate Values When Using BULK INSERT To Insert CSV To SQL Server?

How to prevent duplicate values when using BULK INSERT to insert CSV to SQL Server? Code:

View Replies View Related

Need To Convert This Sql Query For Access To Identical Sql Query For Sql 2005..

My code retrieves a username and a password from a form. Then this information is compared to some usernames and passwords that are stored in a database. The important thing here is that the comparison must be case sensitive meaning that "passWord" is not the same thing as "password"

I have this code, working fine in access 2003

SQL = "SELECT * FROM users WHERE StrComp(username_column,'" & entered_username_in_form & "',0) = 0 AND StrComp(password_column,'" & entered_password_in_form & "',0) = 0"

but get the following error when I run it against my sql 2005 database.

[Microsoft][SQL Native Client][SQL Server]'StrComp' is not a recognized built-in function name.

I don't know the corresponding t-sql for the query.

View Replies View Related

Difference Between Environment Variables And Server Variables

can anyone tell me difference between environment variables and server variables.

View Replies View Related

Query A DB - Pass The Query To Next Page

I am running a querry on an access database and have set the number of records/page displayed at 20. if there are more than 20 records returned, then 1st page will show the first 20, the next page will show next 20 and so on....

The trouble:

the count of total records displayed is correct and the first page is displayed correctly. But when i click on *Next* to go to the next page, all the records of the database get displayed (not the 2nd page of records from the query).

View Replies View Related

Query Access With Multiple Query

I am using ASP/MS ACCESS to see how I can query the same database, via 2 formfields.

{name: - search}Textfield 1: - Search by Category
AND/OR By
{name: - searchT}Textfield 2: - Location

Currently,

strSearchwords = Trim(Request.QueryString("search")); where "search" is the name of Textfield1

Which is fine, but how can I set it so that on Submit, the string from search, and searchT are somehow joined together into one string?

View Replies View Related

Dates

i have an admin page where i have to enter dates.

I enter them in french format : month/day/year, i save, when the page is reloaded, they appear in french format, "day/month/year"... if i save again, they will ve swapped again.. and so on....

what i'd like to know, is how to know the database supported format, the server date format and how to correct this little problem in my task management system i am developing.

View Replies View Related

GMT Dates

lately i just migrate my website to a US webhosting (i am from malaysia) and since then the date is 13 hrs behind.

Understand that to solve this problem i will just need:

DateAdd("h", +13, now())

and the output will be:

4/16/2006 12:30:03 AM

The question is how do i just get 4/16/2006 (without the time)?

View Replies View Related

Using Dates Between

I have this query:

SELECT COUNT(appold.reason) AS Insufficient_Information
FROM appold
WHERE appold.reason LIKE 'Insufficient Information' AND (appold.`date out`
BETWEEN MMColParam1 AND MMColParam2)

MMColParam1 #01/01/2003# Request.QueryString("date1")
MMColParam2 #20/01/2003# Request.QueryString("date2")

and using this link to set the values:

page1.asp?date1=#01/05/2003#&date2=#30/05/2003#

When I test this in the recordset dialog it shows up with the correct count but when I use the link as above I get a 0 count, what am I doing wrong?

View Replies View Related

Dates

I am writing an app that uses ..Now()...
How do I allow for time zone differences?
If I understand, Now() pulls the server time.

View Replies View Related

ASP And Dates

I have a form with 2 fields: Beginning Month and Ending Month. I want to be able to allow the user to select a beginning month and ending month and when they hit submit, it will retreive all records in the table where the month field is equal to or inbetween the months the user selected.

For arguements sake lets set:
strBDate = Request.Form("txtBeginDate")
strEDate = Request.Form("txtEndDate")

SQL: SELECT tb_admin.[Session#], tb_admin.Date_from, tb_admin.Date_to FROM tb_admin WHERE ????????? ;

I know how to connect to the database and pull the data using SQL and WHERE statements but im not sure how to form this WHERE statement.

View Replies View Related

Dates

When I try to select records which have a date greater than todays date it brings back the incorrect records. I think I'v tried everything to get it working and may have missed something. Basically here's what happens.

Todays date is 04/05/2005, but the sql will return records which have a date of 05/04/2005 or greater. Heres the sql:

Select * From trainingCalendar2 where startDate > #04/05/2005# Order By startDate;

And Returns:

2 Course Test 4 07/04/2005 Mandatory Training

10 SAP Training 29/04/2005 External Course

12 Create Course 2 17/05/2005 Internal/Upskilling

I have checked the regional settings and they are correct. When I open the database and look at the records they are of the correct format.

Even when I look at the records in the site that are the correct format. I think it's access but I thought that access was supposed to have the same regional settings as the computer.

View Replies View Related

ASP Dates

Ive got a variable in my code which is used to calculate the age of an entry in the database. The runtime value for the variable is set to Now-14 which checks to see if the article is more than two weeks old. I can change the value to Now()-21 and it still works (flagging all items 3 weeks or newer, but if I increase this to 28, 30 or anything above,

View Replies View Related

Dates

im using date()to return the date in the format dd/mm/yyyy is there any way of changing this to yyyy/mm/dd and the next question is what is the correct delimiter for date in sql statment is this correct?

sSQLinsert into productioninfo where Entry_date = #" & mydate &"#"

View Replies View Related

Dates

How can i add "0" on Months and Days in ASP...What I want to happen is when it saves
to the database it saves 09/01.. this is my sample code:

Day(Request("DateReceived")) & "/" & Month(Request("DateReceived"))

On the code it only return the value 9/1.

View Replies View Related

Dates

i have a page which allows the user to enter an amount of holiday for a year. so i have a inputbox and a submit button. user details are kept in a sql server database in a table. and one of the fields is startdate.. which basically when the user starts using this system he has to enter his personal details and which one of them is the startdate field.

i need to create a function of something that allows me to add the number 5 to the amount which the user adds for a holiday year. This only done once therefor if the users start date exceeds 5 year i need to create a function to add the number 5 to it. the code which i have at the moment ... basically selects the user from a View which i have in my sql server database. obviously it retrieves the users.. record.. depending on what the user inputs as a holiday number in the input box and then it is updated into the table in my database.

View Replies View Related

Dates

I have a problem I'm trying to find the difference between 2 dates in a form. I would like textfield3 the differnce between the dates.:

<script language="JavaScript" type="text/JavaScript">
<!--
<!-- Begin
function calc3() {
numtextfield3 = (document.Form1.textfield1.value -
document.Form1.textfield2.value);
document.Form1.textfield3.value = numtextfield3;
}
// End -->
//-->
</script>

I keep getting an error what I want is if:

textfield1 = 12/03/03 12:05 and
textfield2 = 12/03/03 11:10

View Replies View Related

SQL Dates

I need help with selecting records between certain dates from an Access 2000 db. The dates are held date type in the short date format so they look like so 16/03/2004. I've done the following SQL statement as a test to try and pull out everything from today until a specified date. It does nothing at the moment, the page just renders with no results and no errors.

Code:
strSQL = "SELECT * FROM events WHERE StartDate <= 16/04/2004"

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved