Showing posts with label northwind. Show all posts
Showing posts with label northwind. Show all posts

Monday, March 19, 2012

Get XML from SQL Server 2000

I have a stored procedure, that returns a customer record from the customers table in the northwind database.
how can i return back an xml string of the row?
I mean, when the aspx page calls that procudure, I want to have somehting like:
<customers>
<customer>
<customerid>xxx</customerid>
<companyname>rrr</companyname>
</customer>
</customers>
can a stored procedure return such a string in xml form?
thanks alot

Read up on the FOR XML clause. Here's an article:http://www.sqljunkies.com/Article/296D1B56-8BDD-4236-808F-E62CC1908C4E.scuk and there's quite a bit of good info in BOL.

Wednesday, March 7, 2012

Get some data out of the Northwind db

I'm trying to connect my sql server 2000. Wich components do i need to get, for example, the content in the orders db in the Northwind db.All you need is the classes located in the System.Data.SqlClient namespace. Here is an example on MSDN that gets a list of categories from the Categories table in Northwind:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatasqlclientsqlcommandclassctortopic.asp