How save rich text field into SQL Server

G

Gregor Kurth

Hello

How save rich text field into a Microsoft SQL Server via Web-Service.

I hope somebody can help me.

Perhaps with an example.

Thanks

Gregor
 
B

Ben walters

Gregor,
the Rich text fields in InfoPath are stored as XHTML, you should be able to
store the value contained within as a Text or VarChar type. I recently did
this via a web service by creating a web method that accepted a string, I
then passed in the form's xml definition to the webservice and loaded that
string into an XML Document. Then I simply found the node I wanted using
xpathe and passed the value to an update sproc.
 
G

Gregor Kurth

Hi

It is very complex for me, can help you me?

I have a Webservice, there would have one sql to still integrate.

[WebMethod]
public System.Xml.XmlNode GetXHTMLRichText()
{
//Create a temporary XmlDocument object to generate nodes.
System.Xml.XmlDocument tempDocument = new System.Xml.XmlDocument();

//Create a wrapper node for the data. This is necessary so
InfoPath
//correctly detects the XHTML content
System.Xml.XmlElement theNode =
(System.Xml.XmlElement)tempDocument.CreateNode(
System.Xml.XmlNodeType.Element, "theNode",
"http://somearbitrarynamespace/" );

//Create a "font" element in the xhtml namespace.
System.Xml.XmlElement theFontNode =
(System.Xml.XmlElement)tempDocument.CreateNode(
System.Xml.XmlNodeType.Element, "font",
"http://www.w3.org/1999/xhtml" );
theFontNode.InnerText= "Red Text";

//Add a color attribute.
System.Xml.XmlAttribute colorAttribute =
tempDocument.CreateAttribute(
"color" );
colorAttribute.Value = "#ff0000";
theFontNode.Attributes.Append( colorAttribute );

//Append the font node to the wrapper node
theNode.AppendChild( theFontNode );

//Return the wrapper element.
return theNode;
}

http://support.microsoft.com/kb/826996/en-us

Thanks

Gregor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top