Believe2014
Believe2014

Reputation: 3964

Cannot pass GUID parameter to stored procedure

I can't figure out why I am getting this error.

Could anyone please help?

GUID

UPDATE: Even adding the @ character, the code still does not run. enter image description here

Upvotes: 0

Views: 889

Answers (2)

ANewGuyInTown
ANewGuyInTown

Reputation: 6437

You are missing the parameter type. The equivalent of SqlDbType.UniqueIdentifier is DbType.Guid

Upvotes: 1

Jon Tirjan
Jon Tirjan

Reputation: 3694

Please try the following:

  1. Include @ in your parameter name
  2. Set cmd.CommandType = CommandType.StoredProcedure
  3. Set p.DbType = DbType.Guid

Upvotes: 0

Related Questions