on 2018 Jan 24 12:07 PM
Got the below code:
Add-Type -AssemblyName ("Sap.Data.SQLAnywhere.v4.5, Version=17.0.0.10624, Culture=neutral, PublicKeyToken=f222fc4333e0d400") [bigint] $myvalue = 123456789123456789 $connectionString = "Host=10.10.10.10:12345;Server=testserver;DatabaseName=testdb;UserID=DBA;Password=123" [Sap.Data.SQLAnywhere.SAConnection] $conn = New-Object Sap.Data.SQLAnywhere.SAConnection($connectionString) $conn.Open() [Sap.Data.SQLAnywhere.SACommand] $command = New-Object Sap.Data.SQLAnywhere.SACommand("UPDATE table SET value = ? WHERE value IS NOT NULL", $conn) [Sap.Data.SQLAnywhere.SAParameter] $parameter = New-Object Sap.Data.SQLAnywhere.SAParameter $parameter.SADbType = [Sap.Data.SQLAnywhere.SADbType]::BigInt $parameter.Value = $myvalue [void] $command.Parameters.Add($parameter) try { [void] $command.ExecuteNonQuery() } catch { Write-Error $_ }
And got this exception:
Exception calling "ExecuteNonQuery" with "0" argument(s): "Unable to cast object of type 'System.Numerics.BigInteger' to type 'System.IConvertible'."
I managed to work around this problem by setting $myValue to a string instead of a BigInt.
Are BigInts supported natively with SQLAnywhere .NET Connector?
User | Count |
---|---|
62 | |
10 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.