Ideally you wouldn't store a dataset into a table and read it from the table. That means you need to get the xml out of it and save. and reconstruct the dataset from the xml when you need it.
But if that is your requirement, then you can use the following approach.
1. Create a method that accepts a dataset and returns you a xml representation of it. like,
public static XMLDocument GetXMLData(DataSet ds)
{
//You could stop at getxml's string, or prepare a xmldoc so that it can be used by openxml
string xmlData = ds.GetXml();
XmlDocument xmldoc = new XmlDocument();
xmldoc .LoadXml(xmlData);
return xmldoc ;
}
2. Pass in as XML dbtype through your db classes.
dbHelper.AddInParameter("@xmlData", xmlData.InnerXml, DbType.Xml);
3. In your sp, take a variable
@xmldoc NTEXT
and then say
DECLARE @xmld INT
EXEC SP_XML_PREPAREDOCUMENT @xmld OUTPUT, @xmldoc
4. Finally insert into your table.
INSERT INTO
[TableName]
SELECT
XMLValue = XMLDOC.XmlValueFROM
OPENXML(@xmld , 'Table/Column', NodePos)
WITH
( XmlValue datatype) XMLDOC