You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DbType.Object parameter cannot be an int (or string) #228
[Test]publicvoidParameterExplicitType2DbTypeObjectFromInt(){using(varcommand=newNpgsqlCommand(@"SELECT * FROM data WHERE field_int4=:param",Conn)){varsqlParam=command.CreateParameter();sqlParam.ParameterName="param";sqlParam.DbType=DbType.Object;sqlParam.Value=1;command.Parameters.Add(sqlParam);command.ExecuteScalar();}}
I'll have a go at making this work, hopefully without cludging too much :)
Activity
danzel commentedon May 6, 2014
Infact, setting the DbType to Object before setting a string fails (It works if you set Value before DbType). So I'm thinking this is bugged
[-]DbType.Object parameter cannot be an int[/-][+]DbType.Object parameter cannot be an int (or string)[/+]franciscojunior commentedon May 6, 2014
Yes, you are right! It is really bugged. :(
We are working on this issue in #201. We also have discussions on different levels, but related to this in #146 and #125
Regarding this specific problem, I talk about the solution in this comment: #201 (comment)
I'll create a pull request with this fix so you can give it a try.
Thanks for your feedback on this!
Bunch of failing tests for npgsql#228
danzel commentedon May 6, 2014
Thanks, will close this off and follow #201