Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to save XML(writer) in DataBase
    primarykey
    data
    text
    <p>I'm writing a program where the user is doing some stuff and can save then the XML to his hard drive by using SaveFileDialog().</p> <p>The current code of creating the XML-file is this (snippet which should work by everyone):</p> <pre><code>SaveFileDialog sfd = new SaveFileDialog(); if (sfd.ShowDialog() == DialogResult.OK) { using (XmlWriter writer = XmlWriter.Create(filename)) { try { writer.WriteStartDocument(); writer.WriteStartElement("Questionnaire"); writer.WriteAttributeString("xmlns", "xsi", null, "http://www.w3.org/2001/XMLSchema-instance"); writer.WriteAttributeString("xsi", "noNamespaceSchemaLocation", null, "D:\\Schema.xsd"); writer.WriteStartElement("Title"); writer.WriteString("test"); writer.WriteEndElement(); writer.WriteStartElement("Number"); writer.WriteString("1"); writer.WriteEndElement(); writer.WriteEndElement(); writer.Flush(); writer.Close(); } catch (Exception ex) { System.Windows.MessageBox.Show(ex.Message); } } } </code></pre> <p>Now I also want to save the XML in my database. Either by using the column type <code>xml</code> in my table (I don't know how or what to save into this column) or by saving the full XML Code in a column of type <code>nvarchar</code>, which I actually would like to do.</p> <p>How can I save the XML-file, which was created by a <code>XmlWriter</code> to my database (column of type <code>xml</code> or <code>string</code> which includes the xml)? By saying "which includes the xml" do I mean the full xml code, like</p> <pre><code>&lt;Title&gt; MyTitle &lt;/Title&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload