I am attempting with no success to find a tutorial or a snippet to get me started on connecting to our database and downloading the contents using VBScript. I have the following code, which appears to work:
<%@ Language=VBScript CODEPAGE=65001 %>
<% Option Explicit %>
<%response.Buffer=true%>
<!-- #include file="connect.asp" -->
After that, I found 1 code example, but when I try to run it I get a 500 error. Honestly, I am not even quite sure what some of this syntax does. Any help is appreciated in explaining this more.
<%
sql = "select *"
set resultset = connect.Execute(sql)
Set objFSO=CreateObject("Scripting.FileSystemObject")
outFile="c:\exportDB.csv"
Set objFile = objFSO.CreateTextFile(outFile,True)
Dim row, first_field
while not resultset.EOF
row = ""
first_field = true
For Each field In resultset.Fields
if (first_field = true) then
row = field
first_field = false
else
row = row & ";" & field
end if
Next ' field
objFile.Write row & vbCrLf
resultset.MoveNext
wend
objFile.Close
%>
**UPDATED It appears our development server had features turned off which wasn't allowing me to run these code block and some others. With that now corrected, everything runs as it should.