While Loops And Dates
I want to find the next event in my sql database. To do this, I have a query in a while loop. I set a new DateTime variable to the current date and run the query, it checks to see if it found a suitable event, if not, I want to increase the day by one and loop again.
View Replies
ADVERTISEMENT
Attached is the code that I am trying to put together. Does anyone know how to loop (see bold text below) this so it will display all the data from the columns in this row? Code:
View Replies
View Related
I am not sure how exactly to put this, but what I need to do is the following: taking into account that there are multiple URL's pointing to the same server
If url=blah.com do nothing
if url=blah-blah.com *break out of frameset.
Now I remember there being an easy way to do this but can't for the life of me remember where to find it?
View Replies
View Related
i have 2 loops that give me 2 sets of 25 numbers. code:
do while not rs.eof
value = rs("value1")
rs.movenext
loop
do while not rs.eof
value = rs("value2")
rs.movenext
loop
i need to subtract value 1 from value 2 for each value in the loop?
View Replies
View Related
I was hoping someone would be able to explain the "For Each In Loop" set up.
What I'm really asking is when it can be used and how it is set up.
For example:
If I had something like...
Quote: For Each X in objSomeObject
Response.Write X & "<br /">
Next 'X
How do I know I can use the For Each In Loop and what must I do to be able to use the X portion of it?
Sorry if this is a very general question but I want to understand how one can recognise when it is possible to use this structure and when it's not.
More background to this is that I'm going to attempt to use this structure on a listbox in .NET and possible ASP and I want to ensure that I loop through each and every item.
View Replies
View Related
What I'm trying to do is match all buyer requirements in a database table to all available properties in another table. I then want all these matches displayed in a report with the buyer name followed by the relevant matching properties, this should occur until all buyers have been displayed with their matching properties.
The problem is that it only works correctly for the first buyer for which the correct properties are displayed, after that all I get is the buyer names without their matching properties... so it seems to loop perfectly the first time but from then on forgets about the inner loop! Code:
View Replies
View Related
What I have is a recordset listing out a group of names. I've retrieved the field that lists the id numbers for the array and split them to a list. Then I want it to loop through the names listing trying to highlight the ids that need to be hightlighted.
What I am getting is my list repeats the names according to how many ids are in the array. So if I have 2 numbers in the array I see every name on the list twice and the two that I need selected.
I want the list to show the names one time with the correct names selected. What is wrong with this code? Code:
View Replies
View Related
I have two 2-dimensional arrays (made by using GetRows()) What I need to do is:
Loop
If Arr1(0) = Arr2(0) then
do an update....
End if
End Loop
Basically I need to compare each value in Arr1(0) to the values in Arr2(0) - if I get a match, I have to do an update in the database. What is the easiest way to do this .
View Replies
View Related
there are various of loops but i am analyzing to use which one. maybe i could get some opinions from u all. there are
while wend, for loop, do loop
my situation is if i need 2 execute on a daily basis data on the particular month and will stop on the last day of the month.. without interseeing to the next month
can anyone might help me by suggesting on the suitable loop 2 use for this problem?
View Replies
View Related
I have some difficulty with deep inner loop. What I want is Eg
Product Category: Air-Cond
Company: ABC
Address: 121, Time City, Malaysia.
Company: XYZ
Address: 1, City, Malaysia.
Product Category: Fridge
Company: MAS
Address: 2, Old Building, Singapore.
Company: SAM
Address: 11 Kiosk, Malaysia.
Basically, the first the first loop is to get all product category and one by one insert into the second inner loop. But, I need another inner loop under the second one, which is to categorized by country. Code:
View Replies
View Related
I have successfully paged through a recordset on my page using the .recordCount, etc. methods, the only thing is I have 2 independent recordsets looping on the page, which when there was not paging involved this worked fine, however now I need to span the results of BOTH of these across pages, I just cannot seem to figure out how!
I have one set of records paging fine, but the other either messes the page up, or shows on the first page of results and no more of the other recordset, etc.... so yeah that is basically the problem I am hitting, so I was just wondering is there any examples or ways you could tell me to do this??
View Replies
View Related
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
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
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
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
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
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
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
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
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
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
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
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
After moving a small web app to Win2k3 / IIS 6 the date is being displayed as DDMMYYYY, rather than MMDDYYYY. Can I change something in the regional settings to correct this? Or do I have to change the source?
View Replies
View Related
Basically I have a date that a person completed an exam. A retake date is set off of this completion date (I grab the date and add a certain number of months - i.e. 24, so a completion date of 01/01/2007 would have a retake date of 01/01/2009.)
I'm generating a report for supervisors to be able to look over the employees test history to make sure that the employee is up-to-date on testing.
I want to be able to compare Retake to the current date. If the retake date is in the future (or on the same day - if someone were to look on 01/01/2009) then the employee has a "satisfied" next to them. But if the retake date is in the past, then there is an "incomplete" next to their name.
View Replies
View Related
I am trying to put together a little code that will take the current date and add X number of weekdays to that date.
For instance, if it was a tuesday the 10th, the script would return Friday the 13th. If it was Friday the 13th then the result would be Wednesday the 18th. Basically I need to know where to start with offestting dates based on weekdays
View Replies
View Related
Which format does the IsDate function in asp checks for? I'm taking a date from a form and inserting it into a sql server database which stores the date in mm/dd/yyyy format. Does asp use the same format or do I need to convert it? If so, how do I convert it?
View Replies
View Related
If I have a list with dates how can i seperate them in ranges?
View Replies
View Related
I am editing a script that requires me to output:
Today's date
1 week from today's date
and 4 weeks from today's date.
I am quite new when it comes to ASP programming, could I get some assitance? I need it in MM/DD/YYYY format .
View Replies
View Related
I have a form that lets the web admin add products to the DB, the DB is microsoft access. I know in access you need to use # #'s when dealing with dates, i did and I get the error message: Syntax error in date in query expression '##'
Here is the code thank-you for your time
SQLstmt = "Insert INTO Products(Region, Product_Name, Manf, Weight, Shipping_Cost, Dock_Number, Shipping_Date) values ( '" &_
Region & "', '" & Product_Name & "', '" & Manf& "', '" & Weight& "', '" & Shipping_Cost& "', '" & Dock_number & "', #"& dateValue & "#)"
conn.Execute(SQLstmt)
View Replies
View Related
sql = "SELECT * FROM Calls WHERE Date BETWEEN " &startdate& " AND " &enddate
Where did I go wrong?????????????
Ugly response:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
View Replies
View Related
I store dates in my table as
FDate TDate NoDays
Where Fdate is From Date
TDate is To Date
NoDays is number of days.
We use this to record holidays for our employees.
I would like to write a SQL query which will display all the records where
Fdate or Tdate are within the current month. Not very good at writing SQL
hence need some help.
Some sample data can be like this
Fdate TDate NoDays
15/05/04 18/5/04 4
29/04/04 2/5/04 5
29/5/04 3/06/04 4
If that was the data in the my table and running this query I would expect
it include all the three records when searching for month of "May" as all
three records have atleast one day which falls in the month of May.
View Replies
View Related
We have a few English websites running on a single server and are in the process of adding a Spanish website to the same server. I am trying to determine how one would set the language for a particular website. For example, instead of ASP generating a date like "Monday, July 19, 2004" .
View Replies
View Related