getting the from aspx script

Posted on 2011-05-05
Last Modified: 2012-05-11

I'm trying to add what would be in asp to my aspx script.  Where it says:
myXML.AppendFormat("<a{0} id ='3'
i would rather the id= the equivelent of in asp.

I dont know how the
                 myXML.AppendFormat("<a{0} id ='3'>{1}</a{2}>", i + 1, rdr.GetValue(i).ToString(), i + 1)
line works. I understand Append is to add. I dont know where aspx gets the values for {0} {1} or {2}.
But then thats a different question.

Thanks for your time.
<%@ Page Language="VB" %>
<%@ Import Namespace = "System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<script runat="server">
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Response.ContentType = "text/xml"
        Dim frm1 As String = "arr"  'Request.Form("form1")
        Dim SQL As String
        Dim path As String
        Dim myXML As StringBuilder = New StringBuilder()
        Dim XMLcarrier As String
        Dim CacheRefresh As String = ""
        Select Case frm1
            Case "arr"
                SQL = "SELECT * FROM BackOffice_Mo_Crosstab_cnt"
                path = "App_Data/LOSA.mdb"
            Case "exe"
            Case Else
        End Select
        'If CacheRefresh = "y" Then
        Dim cn As New OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source=" + Server.MapPath(path))
        Dim cmd As New OleDbCommand(SQL, cn)
        Dim rdr As OleDbDataReader = cmd.ExecuteReader(CommandBehavior.CloseConnection)

        myXML.Append("<?xml version='1.0' encoding='ISO-8859-1'?>")
        myXML.Append("<aroot id = '" & Now & "'>")

        While rdr.Read()

            For i As Integer = 0 To rdr.FieldCount - 1
                 myXML.AppendFormat("<a{0} id ='3'>{1}</a{2}>", i + 1, rdr.GetValue(i).ToString(), i + 1)

        End While

        XMLcarrier = myXML.ToString()
        'End If
    End Sub


Open in new window

Question by:Baz487
    LVL 83

    Accepted Solution

    >myXML.AppendFormat("<a{0} id ='3'>{1}</a{2}>", i + 1, rdr.GetValue(i).ToString(), i + 1)

    This is string formatting. The {0} is replaced with "i+1". The {1} is replaced with "rdr.GetValue(i).ToString()" and {2} is again replaced with "i+1".

    >i would rather the id= the equivelent of in asp.
    Do you want to put one of the SQL values there? Try

    myXML.AppendFormat("<a{0} id ='{3}'>{1}</a{2}>", i + 1, rdr.GetValue(i).ToString(), i + 1, rdr.Item("columnname"))
    LVL 142

    Expert Comment

    by:Guy Hengel [angelIII / a3]
    This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    X-Frame-Options - click-jacking 7 37
    black magic design 1 94
    post data with a link 8 45
    Live mode in DW, need to creae Session 4 35
    While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
    The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
    In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
    The goal of the tutorial is to teach the user how to how to record live broadcast.

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now