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 8635849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:04:30+00:00 2026-06-12T10:04:30+00:00

I have following classic asp code: <BODY> <% ‘In this example, we show how

  • 0

I have following classic asp code:

     <BODY>

  <%   
 'In this example, we show how to connect FusionCharts to a database.
 'For the sake of ease, we've used an Access database which is present in
 '../DB/FactoryDB.mdb. It just contains two tables, which are linked to each
 'other. 

 'Database Objects - Initialization
 Dim oRs, oRs2, strQuery
 'strXML will be used to store the entire XML document generated
 Dim strXML

 'Create the recordset to retrieve data
  Set oRs = Server.CreateObject("ADODB.Recordset")

 'Generate the chart element
  strXML = "<graph caption='Factory Output report' subCaption='By Quantity'         decimalPrecision='0' showNames='1' numberSuffix=' Units' pieSliceDepth='30' formatNumberScale='0'>"

 'Iterate through each factory
strQuery = "select * from deal_price"
Set oRs = oConnection.Execute(strQuery)

While Not oRs.Eof
'Now create second recordset to get details for this factory
Set oRs2 = Server.CreateObject("ADODB.Recordset")
strQuery = "select sum(price) as TotOutput from deal_price where deal_id=" &  ors("deal_id")
Set oRs2 = oConnection.Execute(strQuery) 
'Generate <set name='..' value='..'/> 
strXML = strXML & "<set name='" & ors("name") & "' value='" & ors2("TotOutput") & "' />"
'Close recordset
Set oRs2 = Nothing
oRs.MoveNext
Wend
'Finally, close <chart> element
strXML = strXML & "</chart>"
Set oRs = nothing

'Create the chart - Pie 3D Chart with data from strXML
 Call renderChart("MyWeb/includes/FCF_Pie2D.swf", "", strXML, "FactorySum", 650, 450)
 %>
 </BODY>
  </HTML>

DBconnection file code:

Dim oConnection
Set oConnection = Server.CreateObject("ADODB.Connection")
oConnection.Open "Provider=SQLOLEDB; Data Source=MA-PC\SQLEXPRESS; Initial      Catalog=test; User ID=missy; Password=hello;"

I am getting a run time error on the line which says the following:
Set oRs = oConnection.Execute(strQuery).

I can not seem to work out, where I am going wrong. Any Assistant would be very much appreciated. Thanks you in advance.

  • 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-06-12T10:04:31+00:00Added an answer on June 12, 2026 at 10:04 am

    The reason you are getting the error is because your include file (DBConn.asp) is opening the connection, closing it and setting it to Nothing.

    Remove from the DBConn.asp file:

    oConnection.Close
    Set oConnection = Nothing
    

    Change your code:

       'Create the recordset to retrieve data
            Set oRs = Server.CreateObject("ADODB.Recordset")
    
           'Generate the chart element
            strXML = "<graph caption='Factory Output report' subCaption='By Quantity'         decimalPrecision='0' showNames='1' numberSuffix=' Units' pieSliceDepth='30' formatNumberScale='0'>"
    
         'Iterate through each factory
          strQuery = "select * from deal_price"
          Set oRs = oConnection.Execute(strQuery)
    
          While Not oRs.Eof
          'Now create second recordset to get details for this factory
          Set oRs2 = Server.CreateObject("ADODB.Recordset")
          strQuery = "select sum(Quantity) as TotOutput from Factory_Output where FactoryId=" &  ors("FactoryId")
          Set oRs2 = oConnection.Execute(strQuery) 
          'Generate <set name='..' value='..'/> 
          strXML = strXML & "<set name='" & ors("FactoryName") & "' value='" & ors2("TotOutput") & "' />"
          'Close recordset
          Set oRs2 = Nothing
          oRs.MoveNext
        Wend
         'Finally, close <chart> element
          strXML = strXML & "</chart>"
          Set oRs = nothing
    
        'Create the chart - Pie 3D Chart with data from strXML
         Call renderChart("../../FusionCharts/FCF_Pie3D.swf", "", strXML, "FactorySum", 650, 450)
    'Create the recordset to retrieve data
        Set oRs = Server.CreateObject("ADODB.Recordset")
    
       'Generate the chart element
        strXML = "<graph caption='Factory Output report' subCaption='By Quantity'         decimalPrecision='0' showNames='1' numberSuffix=' Units' pieSliceDepth='30' formatNumberScale='0'>"
    
     'Iterate through each factory
      strQuery = "select * from deal_price"
      Set oRs = oConnection.Execute(strQuery)
    
      While Not oRs.Eof
      'Now create second recordset to get details for this factory
      Set oRs2 = Server.CreateObject("ADODB.Recordset")
      strQuery = "select sum(Quantity) as TotOutput from Factory_Output where FactoryId=" &  ors("FactoryId")
      Set oRs2 = oConnection.Execute(strQuery) 
      'Generate <set name='..' value='..'/> 
      strXML = strXML & "<set name='" & ors("FactoryName") & "' value='" & ors2("TotOutput") & "' />"
      'Close recordset
      Set oRs2 = Nothing
      oRs.MoveNext
    Wend
     'Finally, close <chart> element
      strXML = strXML & "</chart>"
      Set oRs = nothing
    
    'Create the chart - Pie 3D Chart with data from strXML
     Call renderChart("../../FusionCharts/FCF_Pie3D.swf", "", strXML, "FactorySum", 650, 450)
    
    
    'Add these lines back in as you are done processing your records
     oConnection.Close
     Set oConnection = Nothing
    
     %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following shortened classic ASP code that makes a SQL insert call...
If I have the following jscript code on a classic asp page, how do
We have a recently internationalised application written in classic ASP. The following code replicates
Need help I have following code with classic asp <select name=state id=state> <option value=NJ>New
I have a Classic ASP page that contains the following code to attempt a
I am using Classic ASP and have the following VB script code From8to14 =
This is related to Classic ASP code. A page fetches data for a particular
I have the following query running on a classic asp page. sSQL = Select
I have a classic ASP page with some code to check if an email
I've begun using ASPUnit to unit test my classic ASP code. This is all

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.