Hi All,
I am unable to get the excel open when user select two dates from my code. Previously i was successfully extracting values by selecting year and month values from the webpage. Could you help me out in writing the Access 2003 SQL query to resolve my issue. Looking forward to your help and support:) I am giving the snapshot of my code: -
<%@Language=VBScript%>
-
-
<%
-
Dim TmplXls
-
Dim DestXls
-
Dim DB
-
Dim DBConn
-
Dim DestXlsConn
-
Dim FSO
-
Dim XlsRS
-
Dim DBRS
-
Dim sqlText
-
Dim strMnth
-
Dim strYear
-
Dim strlte10Pcnt
-
Dim cnt1
-
Dim cnt2
-
Dim cnt3
-
-
-
-
If Request.Form("Fst").Count = 0 Then
-
strStartDate = "(Fst = Format([date],'ddmmyyyy'))"
-
Else
-
For cnt2 = 1 to Request.Form("Fst").Count
-
If cnt2 = 1 Then
-
strStartDate = "(Fst = " & Request.Form("Fst")(cnt2)
-
Else
-
strStartDate = strStartDate & " OR Fst = " & Request.Form("Fst")(cnt2)
-
End If
-
Next
-
strStartDate = strStartDate & ")"
-
End If
-
-
If Request.Form("Lst").Count = 0 Then
-
strLastDate = "(Lst = Format([date],'ddmmyyyy'))"
-
Else
-
For cnt3 = 1 To Request.Form("Lst").Count
-
If cnt3 = 1 Then
-
strLastDate = "( Lst = " & Request.Form("Lst")(cnt3)
-
Else
-
strLastDate = strLastDate & " OR Lst = " & Request.Form("Lst")(cnt3)
-
End If
-
Next
-
strLastDate = strLastDate & ")"
-
End If
-
-
-
-
-
'Response.Write strYear
-
-
TmplXls = Server.MapPath(".") & "\Memory_Use_Sample.xls"
-
DestXls = Server.MapPath(".") & "\Memory_Use.xls"
-
DB = Server.MapPath(".") & "\Server_Monitoring.mdb"
-
-
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
-
FSO.GetFile(TmplXls).Copy DestXls
-
-
-
Set FSO = Nothing
-
-
Set DestXlsConn = Server.CreateObject("ADODB.Connection")
-
DestXlsConn.Open "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = " & DestXls & "; " & "Extended Properties=""Excel 8.0;HDR=NO;"""
-
-
Set XlsRS = Server.CreateObject("ADODB.Recordset")
-
'XlsRS.Open "Select * from Report_Range", DestXlsConn, 1, 3
-
XlsRS.Open "Select * from Memory_Use", DestXlsConn, 1, 3
-
-
Set DBConn = Server.CreateObject("ADODB.Connection")
-
Set DBConn = Server.CreateObject("ADODB.Connection")
-
DBConn.Open "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = " & DB
-
-
Set DBRS = Server.CreateObject("ADODB.Recordset")
-
sqlText = "Select date, Time_Hour, ServerName, MemoryUse from Q1 where date between" & strStartDate
-
-
'strSQL = "SELECT * " & _
-
' "FROM [RECORDS] " & _
-
'"WHERE (CDate(Date_Pur) Between #" & _
-
' Format(Date_From,"m/d/yyyy") & "# And #" & _
-
' Format(Date_To,"m/d/yyyy") & "#)"
-
-
'Response.Write strText
-
' Response.End
-
If Request.Form("Lst").Count > 0 Then
-
sqlText = sqlText & " AND "& strLastDate
-
End If
-
-
'Response.Write sqlText
-
'Response.End
-
-
DBRS.Open sqlText, DBConn, 1
-
'Response.Write sqlText
-
'Response.End
-
-
If DBRS.Recordcount > 0 Then
-
DBRS.MoveFirst
-
-
Dim x, y
-
x = 1
-
Do While Not (DBRS.EOF)
-
XlsRS.AddNew
-
XlsRS.Fields(0).Value = x
-
-
For y = 1 To 4
-
XlsRS.Fields(y).Value = DBRS.Fields(y-1).Value
-
Next
-
XlsRS.Update
-
DBRS.MoveNext
-
x = x + 1
-
Loop
-
-
Response.Write "<META HTTP-EQUIV=""REFRESH"" Content=""0;URL=Memory_Use.xls"">"
-
'Response.Write "Matching records found"
-
-
Else
-
Response.Write "No matching records found"
-
End If
-
-
-
DBRS.Close
-
Set DBRS = Nothing
-
-
DBConn.Close
-
Set DBConn = Nothing
-
-
DestXlsConn.Close
-
Set DestXlsConn = Nothing
-
-
'Response.Write "<META HTTP-EQUIV=""REFRESH"" Content=""0;URL=Memory_Use.xls"">"
-
'XlsRS.Close
-
-
'Set XlsRS = Nothing
-
%>
1 4035
Hi All,
I am unable to get the excel open when user select two dates from my code. Previously i was successfully extracting values by selecting year and month values from the webpage. Could you help me out in writing the Access 2003 SQL query to resolve my issue. Looking forward to your help and support:) I am giving the snapshot of my code:
So what part doesn't work? Are you getting a syntax error when you query the db? Try doing a response.write of the query from the working version and from the current broken version, I bet you will see an obvious difference. If you don't please post both versions of the query (like it looks when finished).
Jared
Sign in to post your reply or Sign up for a free account.
Similar topics
by: lawrence |
last post by:
I'm probably missing something obvious, but I'm unable to write a file
with this function. I've used my FTP software to set permissions to
777 on all the files in question. I've tried r, r+, w, and...
|
by: Justin Emlay |
last post by:
I'm hopping someone can help me out on a payroll project I need to
implement.
To start we are dealing with payroll periods. So we are dealing with an
exact 10 days (Monday - Friday, 2 weeks).
...
|
by: rs |
last post by:
I have a table with a timestamp field which contains the date and time. ie.
9/13/2004 9:10:00 AM.
I would like to split this field into 2 fields, one with just the DATE
portion ie 9/13/2004
and...
|
by: Elric02 |
last post by:
I'm currently trying to get access to the Python source code, however
whenever I try to extract the files using the latest version of WinZip
(version 10) I get the following error "error reading...
|
by: maylee21 |
last post by:
hi, anyone can help me figure out how to read data from a text file
like this:
10980012907200228082002
and extract the data according to this kind of format:
Record type 1
TY-RECORD ...
|
by: kashigal |
last post by:
<?
session_start();
require("db.php");
mysql_connect(MACHINE, USER, '');
mysql_select_db(DBNAME);
$username = $_SESSION;
$pwd =$_SESSION;
|
by: pinpe |
last post by:
Hi,
I have problem of filtering a log file from my perl script.
This is the file content of the file pinpe.csv:
2009-06-16
2009-01-29
2009-06-02
2008-03-05
|
by: GS |
last post by:
I need to extract sections out of a long string of about 5 to 10 KB, change
any date format of dd Mmm yyyy to yyyy-mm-dd, then further from each section
extract columns of tables.
what is the...
|
by: veer |
last post by:
Hi
i am making a program in which i want to extract data from html file .
Actually there are two dates on html file i want to extract these dates but the main probleum is that these dates are...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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,...
|
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...
|
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,...
|
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...
| |