Creating an ADO.net VerticaParameter throws an exception when the data type is set

Creating an ADO.net VerticaParameter throws an exception. You can recreate it with this code: var param = new VerticaParameter(); param.DbType = DbType.Int32; //exception on this line or this code var param = new VerticaParameter("id", 1); And this is the stack trace: System.NullReferenceException: Object reference not set to an instance of an object at Vertica.Data.Internal.ADO.Net.SParameter.SetupNewTypeMetadata (Int32 newProviderType, Boolean isSigned, Boolean throwOnFailure) [0x00000] in :0 at Vertica.Data.Internal.ADO.Net.SParameter.set_DbType (DbType value) [0x00000] in :0

Comments

  • Hi Riaz, sorry for your troubles! Thank you for sharing your code, we will look into the cause of this error.
  • You should not set directly the System.data.DbTYpe, use the 3 parameters ctor instead that lets you chose a VerticaType. To get the right one, you could call the GetVerticaType method on your DbType enum (in this case VerticaType.BigInt.).
  • Thanks for the response but it throws the same error: var param = new VerticaParameter("id", VerticaType.BigInt, 1); System.NullReferenceException: Object reference not set to an instance of an object at Vertica.Data.Internal.ADO.Net.SParameter.SetupNewTypeMetadata (Int32 newProviderType, Boolean isSigned, Boolean throwOnFailure) [0x00000] in :0 at Vertica.Data.Internal.ADO.Net.SParameter.set_DbType (DbType value) [0x00000] in :0 at Vertica.Data.VerticaClient.VerticaParameter.set_Type (VerticaType value) [0x00000] in :0 at Vertica.Data.VerticaClient.VerticaParameter..ctor (System.String name, VerticaType type, System.Object value) [0x00000] in :0 at (wrapper remoting-invoke-with-check) Vertica.Data.VerticaClient.VerticaParameter:.ctor (string,Vertica.Data.VerticaClient.VerticaType,object)
  • Thanks for the reply but using that method resulted in the same exception.
  • Hmm you could try ILSpy on the assembly to find out what's happening, or wait for the dev team to answer... :D BTW I've got problems with this provider too.
  • Hi Danielle, any word on solving this one? Thanks!
  • I have this error too -- Come on Vertica - please respond
  • I cannot find any solution to fix the same problem. Anybody have any idea..?

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file