Parag’s Den

Dedicated to my adored friends…..

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

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


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

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

     adapter = Nothing
     ds = Nothing

End Try


Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

%d bloggers like this: