Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6186491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:53:50+00:00 2026-05-24T01:53:50+00:00

I am in need of using classic ASP to create an XML file from

  • 0

I am in need of using classic ASP to create an XML file from a SQL2005 express database. I am receving a 500 error. I believe my problem is the connection string, I was wondering if I could get a fresh set of eyes on this to possibly provide me a new avenue. Here is the code:

<%
Dim objConn, strConnect, strSQL, rs, tb, objFSO, xmlFile, objWrite
xmlFile = Server.MapPath("inventory.xml")
tb = chr(9)
set objFSO  = Server.CreateObject( "Scripting.FileSystemObject" )
Set objConn = Server.CreateObject( "ADODB.Connection" )
objConn.Open "Provider=SQLOLEDB;Data Source=mybox.com;Initial      Catalog=myDB;UserId=myID;Password=myPW;"

If Not objFSO.FileExists( xmlFile ) Then objFSO.CreateTextFile( xmlFile )
set objWrite = objFSO.OpenTextFile( xmlFile, 2 )


objWrite.WriteLine("<?xml version=""1.0"" encoding=""ISO-8859-1""?>")
objWrite.WriteLine("<data>")

strSQL = "SELECT * FROM table1"
Set rs = objConn.Execute(StrSQL)


Do While not rs.EOF
objWrite.WriteLine(tb & "<marker>")
objWrite.WriteLine(tb & tb & "<name>" & rs("name") & "</name>")
objWrite.WriteLine(tb & tb & "<address>" & replace(rs("address"),"&","&amp;") & "</address>")
objWrite.WriteLine(tb & tb & "<city>" & rs("city") & "</city>")
objWrite.WriteLine(tb & tb & "<state>" & rs("size") & "</state>")
objWrite.WriteLine(tb & tb & "<zipcode>" & rs("zipcode") & "</zipcode>")
objWrite.WriteLine(tb & tb & "<lat>" & rs("lat") & "</lat>")
objWrite.WriteLine(tb & tb & "<lng>" & rs("lng") & "</lng>")
objWrite.WriteLine(tb & "</marker>")
rs.MoveNext
Loop


objWrite.WriteLine("</data>")
objWrite.Close()
%>

I appreciate any fresh perspective anyone can share.
Thanks,
–Matt

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T01:53:52+00:00Added an answer on May 24, 2026 at 1:53 am

    The thing that stands out most to me is your connection string. I’m not sure how it handles the extra spaces in "Initial Catalog", but I can say that mybox.com is almost certainly the wrong value for the data source. You should use an internal name there, and not expose your database to the public internet.

    Also, it’s been a long time since I’ve used classic asp, but IIRC you need to call .MoveNext() before accessing any records — at the top of the loop rather than the bottom.

    Finally, don’t forget to close your connection, and use good error handling there to make sure it will reach the code that closes both the connection and the file, even if an error occurs earlier in the code. Otherwise you’ll end up locking the file or database on yourself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to get the Windows domain name from Internet Explorer using classic asp
I know how to find what I need from XML using XPath. The syntax
Using Classic ASP (stop tutting), I need to build an application that transfers high
I need to get visitors country information using classic asp 3.0, i'm using below
I am in need of using Classic ASP with Access. This is a requirement
I need to pass some data from a classic ASP application to my ASP.NET
I need to call a VBscript function on a classic asp page from some
We're implementing a new solution in our classic ASP environment that's using COM interop
I am using ASP classic with ADO, connecting to SQL Server 2008. I inherited
Using classic ASP I want to clear a form that auto populates with session

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.