473,503 Members | 2,720 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Trying to generate dynamic xml using aspx

1 New Member
Sorry, but I'm pretty new to .NET/XML etc...

I have the current code which I'm trying to output dynamically so it can be read into a flash file. The only issue is, it doesn't seem to actually do anything. What am I missing? I have been able to output to an xml file, but not dynamically.

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Xml" %>
<%@ Import Namespace="System.Data.OleDb" %>
<%@ OutputCache Duration="1" VaryByParam="none" %>

<script runat="server">

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Dim DBConnection As OleDbConnection
Dim DBAdapter As OleDbDataAdapter
Dim SQLString As String
Dim BacklogDS As DataSet
Dim day30Str As String = "30 Day"
Dim day60Str As String = "60 Day"
Dim day90Str As String = "90 Day"
Dim dayTotalStr As String = "Total"
Dim nullStr As String = ""
Dim day30Int As Integer
Dim day60Int As Integer
Dim day90Int As Integer
Dim dayTotalInt As Integer
'Set variable depatmentStr static for testing
Dim departmentStr As String = "0127"
'Set variable depatmentStr static for testing
Dim departmentBackStr As String = "Department " + departmentStr + " Backlog"

'Connect to DailyLoad.mdb
'Query "SELECT TOP 1 EUPLoad30, EUPLoad60, EUPLoad90, EUPLoadTTL FROM tblEupdaily WHERE (Department = '" & DropDownList1.SelectedItem.Text & "') ORDER BY dateDaily DESC"
DBConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
SQLString = "SELECT TOP 1 EUPLoad30, EUPLoad60, EUPLoad90, EUPLoadTTL FROM tblEupdaily WHERE (Department = '" & departmentStr & "') ORDER BY dateDaily DESC"
DBAdapter = New OleDbDataAdapter(SQLString, DBConnection)

'write query to DataSet
BacklogDS = New DataSet("chart")
DBAdapter.Fill(BacklogDS, "chart")

'assign variables from DataSet
day30Int = BacklogDS.Tables("chart").Rows(0)("EUPLoad30")
day60Int = BacklogDS.Tables("chart").Rows(0)("EUPLoad60")
day90Int = BacklogDS.Tables("chart").Rows(0)("EUPLoad90")
dayTotalInt = BacklogDS.Tables("chart").Rows(0)("EUPLoadTTL")

'create chart_xml.xml
Dim rank As Integer = 1
Dim settings As New XmlWriterSettings()
settings.Indent = True
settings.NewLineOnAttributes = True
settings.Encoding = Encoding.UTF8
settings.CloseOutput = False
Response.ContentType = "text/xml"
Using writer As XmlWriter = XmlWriter.Create(Response.OutputStream, settings)
writer.WriteStartDocument()

writer.WriteStartElement("chart")
writer.WriteStartElement("chart_data")

writer.WriteStartElement("row")
writer.WriteElementString("null", nullStr)
writer.WriteElementString("string", day30Str)
writer.WriteElementString("string", day60Str)
writer.WriteElementString("string", day90Str)
writer.WriteElementString("string", dayTotalStr)
writer.WriteEndElement()

writer.WriteStartElement("row")
writer.WriteElementString("string", departmentBackStr)
writer.WriteElementString("number", day30Int)
writer.WriteElementString("number", day60Int)
writer.WriteElementString("number", day90Int)
writer.WriteElementString("number", dayTotalInt)
writer.WriteEndElement()

writer.WriteEndElement()
writer.WriteEndElement()

writer.WriteEndDocument()
writer.Flush()
End Using
End Sub
</script>
May 24 '07 #1
1 1571
oohay251
27 New Member
try writing your dataset directly after your fill it and see if it does as least that much.

use the WriteXml(Response.Output) overloaded method.

or write it to file WriteXml(@"c:\temp\out.xml")
May 25 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
6613
by: Robson Carvalho Machado | last post by:
Dear Friends, I was using the below code in ASP to dynamically generate XML from a SQL Query Does anyone knows how can I migrate this code to VB and ASPX? Regards Robson Machado ...
5
10002
by: Popoxinhxan | last post by:
HI guy I am working on the web application that required to display the chart image on the page. The process is clicking the button and browser will popup another windows that displayed...
0
2116
by: Martin | last post by:
Hi. I had a very frustrating afternoon and evening but I have got it all under control now so all of a sudden I am in a good mood. I want to share some insights on output caching with you lot. ...
12
3068
by: Ron Weldy | last post by:
I have a test server runinng 2003/IIS 6 with a mixture of asp and asp.net files. On my workstation I have a share set up to the folder where the web files reside. I am just doing quick and dirty...
8
2001
by: George Meng | last post by:
I got a tough question: The backgroud for this question is: I want to design an application works like a engine. After release, we can still customize a form by adding a button, and source code...
2
1535
by: Adnan Al-Ghourabi | last post by:
Hi, We have a need to create pages on the fly for ASP.NET applications based on some string that the Url ends with. For example: http://www.domain.com/SomePath/aabbccdd. "aabbccdd" does not...
4
17386
by: Mike Logan | last post by:
I would like to dynamically create a Visio diagram from .Net. I tried looking at the Visio SDK, but the samples are extremely convoluted for me to understand. Does someone have an example of...
5
1878
by: vikram | last post by:
I am developing a display web site which displays several listing and details, data is picked up from database for the lists. There is no search criteria but only pagination stuff. What i am...
111
4550
by: Nate | last post by:
Hello, I am looking for a method to automatically declare variables in C. I'm not sure if there is a good way to do this, but I had something like this in mind... int i; for(i = 1; i < 4;...
0
7063
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...
0
7258
Oralloy
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,...
0
7313
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6970
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5558
agi2029
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,...
0
4663
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3146
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1489
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
720
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.