getting the x.name from aspx script

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

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

CodeCruiser earned 2000 total points
ID: 35832140
>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 x.name 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 143

Expert Comment

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

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.
Suggested Courses

749 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