Parag’s Den

Dedicated to my adored friends…..

  • Blog Status

    • 8,357 Visits so far
  • Categories

  • Recent Posts

  • Calender

    November 2007
    M T W T F S S
    « Oct   Jun »
     1234
    567891011
    12131415161718
    19202122232425
    2627282930  
  • Advertisements

Asp.Net (Generating XML from a DataSet)

Posted by paragdongre on November 6, 2007


Generating XML from a dataset is very simple. All we have to do is invoke the dataset method, GetXml.

Dim adapter As SqlDataAdapter
Dim ds As DataSet

Try
     adapter = New SqlDataAdapter(“YourSQLStatement”, “YourConnectionString”)
     ds = New DataSet()
     adapter.Fill(ds, “myTable”)

     Response.Write(ds.GetXml)

Catch exc As SqlException
     Response.Write(“SQL Error Occured: ” & exc.ToString)

Catch exc As Exception
     Response.Write(“Error Occured: ” & exc.ToString)

Finally
     adapter = Nothing
     ds = Nothing

End Try

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: