I think this is covered in the blackpearl Wrox book but I don't have it in front of me to reference the page number but Jason Aperigis also has a really nice post on this as well here: http://www.k2distillery.com/2008/02/working-with-infopath-xml-and-archiving.html.
Hope this helps.
Thanks Jason,
I tired the same code earlier, but that time its works.. but this its seems to be working with some modification as i want to access the xml values not update..
Here is the modified code to access InfoPath field vales in code as XML
//Get the XML Field string
string xml = K2.ProcessInstance.XmlFields["XXX"].Value.ToString();
//Load up the XML
XmlDocument doc = new XmlDocument();
doc.LoadXml(xml);
//Create a name space manager for InfoPath
XmlNamespaceManager nsMgr = new XmlNamespaceManager(doc.NameTable);
nsMgr.AddNamespace("my", doc.DocumentElement.GetNamespaceOfPrefix("my"));
//Now set some values
fieldvalue = doc.SelectSingleNode("//my:Company/my:CompanyID", nsMgr).InnerText;
Now you can use this field value to update the database by just writing a normal inline query.
Thanks again for your help .
Regards
Parveen