getting the from aspx script

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

Who is Participating?
CodeCruiserConnect With a Mentor Commented:
>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"))
Guy Hengel [angelIII / a3]Billing EngineerCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.