0

I'm trying to convert a sample for running a SQL/XML "UpdateGram" from VB to C#.

VB Example:

 conn.Properties("SQLXML Version") = "SQLXML.4.0"  

C# Attempts:

 conn.Properties["SQLXML Version"] = "SQLXML.4.0";

Error: cannot be assigned, is read only.

VB Source: https://learn.microsoft.com/en-us/sql/relational-databases/sqlxml-annotated-xsd-schemas-xpath-queries/updategrams/executing-an-updategram-by-using-ado-sqlxml-4-0?view=sql-server-ver15

NealWalters
  • 17,197
  • 42
  • 141
  • 251

1 Answers1

3
conn.Properties["SQLXML Version"].Value = "SQLXML.4.0";

That is exactly what is shown in the codes samples at that link you've mentioned.

I see where the confusion could have arrived from though, there is a purple "Notes" block that does (erroneously) contain the conn.Properties("SQLXML Version") = "SQLXML.4.0" line. This appears to be a leftover from VB6/A, where parameterless default properties were allowed. They are not allowed in VB.NET, so that line wouldn't work in VB.NET either.

GSerg
  • 76,472
  • 17
  • 159
  • 346