I am as stuck as a stuck thing on stuck day.
Could someone have a look at the code to see what I have missed.
I need to get this done asap and I feel like crap.
code below (I have removed sone db connection stuff)
Cheers
Manic
<OptionExplicit>
<%@ LANGUAGE="VBSCRIPT" %>
<% RESPONSE.BUFFER = TRUE %>
<%
Function WriteFile
DIM fileSys
DIM textStr
SET fileSys = Server.CreateObject ("Scripting.FileSystemObject"
'file destination needs to be changed
Const saveFolder = "C:\Inetpub\ 'file extention needs to be checked and add date to front of name
saveFile = "BACSau.txt"
If (NOT fileSys.FolderExists(saveFolder)) Then
fileSys.CreateFolder saveFolder
End If
Set textStr = fileSys.OpenTextFile(saveFolder+saveFile, 8, true)
textStr.WriteLine Sortcode & AccNo & Ammount & AccName & Reference & TransCode
textStr.Close
Set fileSys = Nothing
Set textStr = Nothing
%>
<% include file="adovbs.inc" %>
<html><head><title>dd test</title></head><body>
<%
const adopenstatic = 3, adlockreadonly = 1, adcmdtext = &h0001
Dim CONN_STRING, CONN_USER, CONN_PASS ' database connection string
Dim myRs ' ADODB.Recordset Object
Dim myConn ' ADODB.Connection Object
Dim strSQL ' SQL string
Dim i
CONN_STRING = "Provider=SQLOLEDB;Data Source=?;Database=?;UID=?;PWD=?"
set myconn = server.createobject("adodb.connection"
set myrs = server.createobject("adodb.recordset"
myconn.open conn_string
strsql = "select a.created as CreationDate,a.attrib_04 as PaymentType,a.attrib_06 as AccountName,floor(a.attrib_20) as SortCode,floor(a.attrib_21) as AccountNumber from s_org_ext_x a where a.attrib_04 = 'Direct Debit' and a.created >= '2001-01-25' and a.created < '2001-01-26'"
myrs.open strsql, myconn, adopenstatic, adlockreadonly, adcmdtext
For i = 0 to myRs.Fields.Count -1 and CreationDate = DateValue(Now()) -1 & Attrib_04 = "Direct Debit"
response.WriteFile
next
if myrs.bof then
response.write "no records found!"
else
myrs.movefirst
end if
myrs.close
myconn.close
set myrs = nothing
set myconn = nothing
%>
</body></html> -----------------------------
I've broken it again !!
-----------------------------
Could someone have a look at the code to see what I have missed.
I need to get this done asap and I feel like crap.
code below (I have removed sone db connection stuff)
Cheers
Manic
<OptionExplicit>
<%@ LANGUAGE="VBSCRIPT" %>
<% RESPONSE.BUFFER = TRUE %>
<%
Function WriteFile
DIM fileSys
DIM textStr
SET fileSys = Server.CreateObject ("Scripting.FileSystemObject"
'file destination needs to be changed
Const saveFolder = "C:\Inetpub\ 'file extention needs to be checked and add date to front of name
saveFile = "BACSau.txt"
If (NOT fileSys.FolderExists(saveFolder)) Then
fileSys.CreateFolder saveFolder
End If
Set textStr = fileSys.OpenTextFile(saveFolder+saveFile, 8, true)
textStr.WriteLine Sortcode & AccNo & Ammount & AccName & Reference & TransCode
textStr.Close
Set fileSys = Nothing
Set textStr = Nothing
%>
<% include file="adovbs.inc" %>
<html><head><title>dd test</title></head><body>
<%
const adopenstatic = 3, adlockreadonly = 1, adcmdtext = &h0001
Dim CONN_STRING, CONN_USER, CONN_PASS ' database connection string
Dim myRs ' ADODB.Recordset Object
Dim myConn ' ADODB.Connection Object
Dim strSQL ' SQL string
Dim i
CONN_STRING = "Provider=SQLOLEDB;Data Source=?;Database=?;UID=?;PWD=?"
set myconn = server.createobject("adodb.connection"
set myrs = server.createobject("adodb.recordset"
myconn.open conn_string
strsql = "select a.created as CreationDate,a.attrib_04 as PaymentType,a.attrib_06 as AccountName,floor(a.attrib_20) as SortCode,floor(a.attrib_21) as AccountNumber from s_org_ext_x a where a.attrib_04 = 'Direct Debit' and a.created >= '2001-01-25' and a.created < '2001-01-26'"
myrs.open strsql, myconn, adopenstatic, adlockreadonly, adcmdtext
For i = 0 to myRs.Fields.Count -1 and CreationDate = DateValue(Now()) -1 & Attrib_04 = "Direct Debit"
response.WriteFile
next
if myrs.bof then
response.write "no records found!"
else
myrs.movefirst
end if
myrs.close
myconn.close
set myrs = nothing
set myconn = nothing
%>
</body></html> -----------------------------
I've broken it again !!
-----------------------------