Torna al Thread
Imports System
Imports System.IO
Imports System.Text
Imports System.Collections
Imports System.Reflection
Imports System.Security.Permissions
Imports System.Web
Imports System.Xml
Imports System.Configuration
******************************
Response.Clear()
Response.ContentType = "text/xml"
Response.ContentEncoding = Encoding.UTF8
Dim objX As New XmlTextWriter(Response.OutputStream, Encoding.UTF8)
objX.WriteStartDocument()
objX.WriteStartElement("rss")
objX.WriteAttributeString("version", "2.0")
objX.WriteAttributeString("xmlns:g", "http://base.google.com/ns/1.0")
objX.WriteStartElement("channel")
objX.WriteElementString("title", "Artistic")
objX.WriteElementString("description", "Artistic")
objX.WriteElementString("link", "http://www.artistic.it/")
Dim sql As String = "SELECT '' as NomeItem,[titolo] ,[link] ,[description] ,[datainserimento],[riga] ,[codicelingua] ,[id] ,[prezzo] ,[condizione] ,[linkimmagine] ,[disponibilita] ,[categoria] ,[qta] ,[spedizione] ,[elaborato] FROMxxxx where codicelingua = '001'"
Dim objCommand As New SqlCommand(sql, objDB)
Dim objReader As SqlDataReader = objCommand.ExecuteReader()
Try
'Dim DR2 As SqlDataReader
'file documento
'Dim XmlFileDoc As New XmlDocument
'XmlFileDoc.Load(StrNomeFile & ".xml")
'#qui recuperi una lista di channel. quindi credo che tu voglia usare più channel all'interno del file?
'#poi sotto usi l'indice 0 quindi il primo channel che hai recuperato. ?
'Dim xmlNodi As XmlNodeList = XmlFileDoc.GetElementsByTagName(StrRadice)
'creo il nodo o meglio l'elemento
'# QUI SCORRI IL DATAREADER IN MODO DA AGGIUNGERTI TUTTI GLI ITEM CHE
'# HAI RECUPERATO CON LA QUERY:
While objReader.Read() ' per ogni riga letta
objX.WriteStartElement("item")
objX.WriteElementString("id", objReader("productId").ToString())
objX.WriteElementString("title", objReader("productTitle").ToString())
objX.WriteElementString("description", objReader("productDesc").ToString())
objX.WriteElementString("g:price", objReader("productPrice").ToString())
objX.WriteElementString("link", objReader("productLink").ToString())
objX.WriteElementString("g:image_link", objReader("productImage").ToString())
objX.WriteElementString("g:brand", objReader("productBrand").ToString())
objX.WriteElementString("g:product_type", objReader("productType").ToString())
objX.WriteElementString("g:upc", objReader("productUPC").ToString())
objX.WriteElementString("g:weight", objReader("productWeight").ToString())
'### CLOSE ITEM
objX.WriteEndElement()
End While
objReader.Close()
objX.WriteEndElement()
objX.WriteEndElement()
objX.WriteEndDocument()
objX.Flush()
objX.Close()
Catch ex As Exception
Write("C:\servizi\FileLog.txt", "Errore nella srittura file 002")
End Try