Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First of all, I recommend that you never process XML as a string. You should always use an API that is sensitive to the rules of XML. In this case, you should use one of the overloads of DataSet.WriteXml.</p> <p>Second, when you say "null", are you referring to DBNull? That is, a NULL in database terms, or are you referring to the value <code>null</code> in C# and <code>Nothing</code> in VB.NET?</p> <p>Finally, why do you want these columns to appear? They're only taking up space.</p> <hr> <p><strong>Edits:</strong> </p> <ol> <li><p>Correction to code: this code is inefficient: saving the <code>DataSet</code> to an XML string, then parsing the XML again to load into an <code>XmlDocument</code>, and then finally writing out the XML again to the request stream. It also uses <code>XmlTextWriter</code>, which is deprecated as of .NET 2.0. The following is a lot cleaner:</p> <pre><code>Dim settings As New XmlWriterSettings With {.Indent = True} Using stream = req.GetRequestStream Using writer = XmlWriter.Create(stream, settings) dsUpload.WriteXml(writer, XmlWriteMode.IgnoreSchema) End Using End Using </code></pre></li> <li><p>From research, there doesn't seem to be an easy way to force the columns to appear. You could replace all the <code>DBNull.Value</code> values with the default value for their type (note <code>String.Empty</code> is only going to work if the .NET type of the column is <code>string</code>. It's not going to work for a <code>DateTime</code> column, for instance). Once set to something other than <code>DBNull.Value</code>, I think you're going to have to go through all the columns in the table, and set their <code>AllowDBNull</code> property to <code>false</code>.</p></li> </ol> <p>What really needs to happen is that the site you're uploading to needs to learn XML. It's disgraceful in this day and age for software to not understand XML well enough for you to supply an XML Schema in order for them to understand which columns to expect. </p> <p>If you feel comfortable saying which site this is, I'm sure we'll all be glad to publicly ridicule them.</p> <p>:-)</p>
    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.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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