Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dataset or XML
Message
 
À
10/10/2003 20:45:22
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Divers
Thread ID:
00837727
Message ID:
00837739
Vues:
34
>>What do you need to convert? It is C#? Are you using the Code-behind page? Are you using VB.NET? Are you coding inside of the .ASPX instead of the code-behind? You will need the System.Data, and the System.Xml reference.
>
>Yes, the code is in the aspx page.
>
>I am using VB.NET code.

Oh. Ok. No prob. Well, first I would recommend you putting the code in the code behind to separate the logic and the design, but that is a design decision. Here is the converted VB.NET code.
Public Sub ImportXML(Data As DataSet, XML As String)
   Dim sr As New StringReader(XML)
   Data.ReadXML(sr, XmlReadMode.InferSchema)
   Data.AcceptChanges()
End Sub 'ImportXML
A great webservice to convert from C# to VB.NET is available here.
http://authors.aspalliance.com/aldotnet/examples/translate.aspx

To put it in the .aspx page..
You can put it in the page like this.
<Script Runat="Server">

Sub Page_Load( s As Object, e As EventArgs )
 'CallImportXML here
End Sub

Public Sub ImportXML(Data As DataSet, XML As String)
   Dim sr As New StringReader(XML)
   Data.ReadXML(sr, XmlReadMode.InferSchema)
   Data.AcceptChanges()
End Sub 'ImportXML
</Script>
I would recommend putting your code in the code-behind though, check out this.

http://www.c-sharpcorner.com/FreeChapters/SMS/Chap6SeperatingCodeASPNETUnleashed.asp


I hope that helps.

Morgan
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform