Ciao a tutti.
Sto tentanto con .net di creare un file xml contenente dati estrapolati da un database access.
Io ho sempre usato ASP 3 e con .net non mi trovo tanto bene.
Il mio problema è inserire le variabili estrapolate dalle colonne del database nel codice per creare xml utilizzando writer.writeattributestring.
Faccio prima a inserire il codice:
<script runat="server">
sub Page_Load(obj as object, e as EventArgs)
dim campo1 as string
dim campo2 as string
dim myConnection as new OleDbConnection ("Provider=Microsoft.jet.OLEDB.4.0;Data Source="&Request.ServerVariables("APPL_PHYSICAL_PA TH")&"data\test.mdb")
dim myCommand as new OleDbDataAdapter ("select * from asasa", myConnection)
dim ds as DataSet = new DataSet()
myCommand.Fill(ds, "asasa")
Repeater1.DataSource = ds.Tables("asasa").DefaultView
campo1=ds.Tables("asasa").Columns("nome")
campo2=ds.Tables("asasa").Columns("cognome")
DataBind()
dim writer as xmltextwriter
try
writer = new xmltextwriter(Server.MapPath("risultato.xml"), nothing)
writer.writestartdocument
writer.formatting = formatting.indented
writer.indentation = 3
writer.writestartelement("folder")
writer.writeattributestring("name",campo1)
writer.writeelementstring("object name="&campo1&, "")
writer.writeelementstring("object name="&campo2&, "")
writer.writeendelement()
writer.flush
catch ex as exception
response.write("Errore nell'accesso al file xml")
finally
writer.close
response.write("Processo terminato")
end try
end sub
</script>
Spero di essermi spiegato.
Grazie a tutti per l'aiuto