Skip to main content

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

  • May 29, 2013
  • 8 replies
  • 21 views

Riaz_Missaghi
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

8 replies

Forum|alt.badge.img+2
  • Participating Frequently
  • May 29, 2013
Hi Riaz, sorry for your troubles! Thank you for sharing your code, we will look into the cause of this error.

François_Jehl_1
Forum|alt.badge.img
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.).

Riaz_Missaghi
  • Author
  • New Participant
  • May 30, 2013
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)

Riaz_Missaghi
  • Author
  • New Participant
  • June 4, 2013
Thanks for the reply but using that method resulted in the same exception.

François_Jehl_1
Forum|alt.badge.img
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.

Riaz_Missaghi
  • Author
  • New Participant
  • June 13, 2013
Hi Danielle, any word on solving this one? Thanks!

Terry_Marr
Forum|alt.badge.img+1
  • Participating Frequently
  • July 20, 2013
I have this error too -- Come on Vertica - please respond

Hope
  • New Participant
  • December 11, 2013
I cannot find any solution to fix the same problem. Anybody have any idea..?