ASP.NET - error en funcion

 
Vista:

error en funcion

Publicado por michel maureia (3 intervenciones) el 16/04/2007 21:54:16
tengo una funcion k me transforma los datos mostrados en el webform a xml , en el primer formulario lo realiza bien , pero en el segundo que hize otra consulta a otra tabla me despliega los datos pero al ejecutar la función no me hace nada.

!!!Ojala me puedan ayudar , nose que variable es la que falla , Gracias!!!

Codigo de la primera : "El que Funciona "

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

'Connect to the data source.
Dim objConn As New System.Data.OleDb.OleDbConnection(strConn)
Try
objConn.Open()
'Fill the dataset with records from the Customers table.
Dim strSQL As String
Dim objDataset As New DataSet
Dim objAdapter As New System.Data.OleDb.OleDbDataAdapter

'The OLEDbDataAdapter acts as a bridge between the data source,
'in this case the Customers table, and the dataset.
objDataset.GetXmlSchema()

strSQL = "SELECT Cargo, CiudadDestinatario, CódPostalDestinatario, Destinatario, DirecciónD" & _
"estinatario, FechaEntrega, FechaEnvío, FechaPedido, FormaEnvío, IdCliente, IdEmp" & _
"leado, IdPedido, PaísDestinatario, RegiónDestinatario FROM Pedidos"
Me.OleDbSelectCommand1.Connection = Me.OleDbConnection1
objAdapter.SelectCommand = New System.Data.OleDb.OleDbCommand( _
strSQL, objConn)
objAdapter.Fill(objDataset)

'Create the FileStream to write with.
Dim strFilename As String
strFilename = "C:\Noticia.xml"
Dim fs As New System.IO.FileStream(strFilename, _
System.IO.FileMode.Create)

'Create an XmlTextWriter for the FileStream.
Dim xtw As New System.Xml.XmlTextWriter(fs, _
System.Text.Encoding.Unicode)

'Add the processing instruction to the beginning of the XML
' file, leaving the one which indicates a style sheet commented.
xtw.WriteProcessingInstruction("xml", "version='1.0'")
'xtw.WriteProcessingInstruction( _
'"xml-stylesheet", "type='text/xsl' href='customers.xsl'")
'xtw.
'Write the XML from the dataset to the file.
objDataset.WriteXml(xtw)
objDataset.GetXml()

xtw.Close()

MsgBox("Customer data has been exported to C:\Customers.xml.")
Catch ex As Exception
' MsgBox(ex.Message)
End Try

End Sub

Codigo del Segundo "No Funciona "

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

'Connect to the data source.
Dim objConn As New System.Data.OleDb.OleDbConnection
Try
objConn.Open()
'Fill the dataset with records from the Customers table.
Dim strSQL As String
Dim objDataset As New DataSet
Dim objAdapter As New System.Data.OleDb.OleDbDataAdapter

'The OLEDbDataAdapter acts as a bridge between the data source,
'in this case the Customers table, and the dataset.
objDataset.GetXmlSchema()
Me.OleDbSelectCommand1.CommandText = "SELECT CantidadPorUnidad, fds, IdCategoría, IdProducto, IdProveedor, NivelNuevoPe" & _
"dido, NombreProducto, PrecioUnidad, Suspendido, UnidadesEnExistencia, UnidadesEn" & _
"Pedido FROM Productos"
Me.OleDbSelectCommand1.Connection = Me.OleDbConnection1
objAdapter.SelectCommand = New System.Data.OleDb.OleDbCommand( _
strSQL, objConn)
objAdapter.Fill(objDataset)

'Create the FileStream to write with.
Dim strFilename As String
strFilename = "C:\Noticia2.xml"
Dim fs As New System.IO.FileStream(strFilename, _
System.IO.FileMode.Create)

'Create an XmlTextWriter for the FileStream.
Dim xtw As New System.Xml.XmlTextWriter(fs, _
System.Text.Encoding.Unicode)

'Add the processing instruction to the beginning of the XML
' file, leaving the one which indicates a style sheet commented.
xtw.WriteProcessingInstruction("xml", "version='1.0'")
'xtw.WriteProcessingInstruction( _
'"xml-stylesheet", "type='text/xsl' href='customers.xsl'")
'xtw.
'Write the XML from the dataset to the file.
objDataset.WriteXml(xtw)
objDataset.GetXml()
MsgBox("Customer data has been exported to C:\noticia2.xml.")
xtw.Close()

MsgBox("Customer data has been exported to C:\noticia2.xml.")
Catch ex As Exception
' MsgBox(ex.Message)
End Try

End Sub
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder