We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Today, it's possible to read a UDT value as a SqlBytes object from SqlDataReader using GetSqlBytes.
var connection = new SqlConnection(@"Data Source=(localdb)\MSSQLLocalDB"); connection.Open(); var command = connection.CreateCommand(); command.CommandText = "SELECT geometry::Parse('POINT(0 0)')"; var reader = command.ExecuteReader(); reader.Read(); var geometrySqlBytes = reader.GetSqlBytes(0);
Unfortunately, there is no way to specify a UDT value as a SqlBytes object in SqlParamter.
var connection = new SqlConnection(@"Data Source=(localdb)\MSSQLLocalDB"); connection.Open(); var command = connection.CreateCommand(); command.CommandText = "SELECT @Point.X"; var parameter = command.Parameters.AddWithValue("@Point", geometrySqlBytes); parameter.SqlDbType = SqlDbType.Udt; parameter.UdtTypeName = "geometry"; // ArgumentException: Specified type is not registered on the target server. SqlBytes var x = command.ExecuteScalar();
SqlBytes should be special cased in this codepath as a means of merely specifying the bytes to send to the server.
cc @ajcvickers @divega
The text was updated successfully, but these errors were encountered:
Thanks @bricelam I can confirm that this is happening both in .Net Core and .Net Framework.
Sorry, something went wrong.
@bricelam What is the use case for this? How will the bytes be constructed in the first place ?
NVM I read through NetTopologySuite/NetTopologySuite#302
Update SqlParameter example
403e6f3
Direct users to take advantage of dotnet/corefx#35470
Successfully merging a pull request may close this issue.
Today, it's possible to read a UDT value as a SqlBytes object from SqlDataReader using GetSqlBytes.
Unfortunately, there is no way to specify a UDT value as a SqlBytes object in SqlParamter.
SqlBytes should be special cased in this codepath as a means of merely specifying the bytes to send to the server.
cc @ajcvickers @divega
The text was updated successfully, but these errors were encountered: