hi. I believe I have found a bug in iAnywhere17.

I have some simple code

from a in db.ActiveLoginKeys   
where a.lok_key.Contains(key)
select a

This worked fine under iAnywhere12 and EF5 but now I've upgraded to 17 and ef6 I get this error whenever I do a .contains linq command

"internalexception": {
          "message": **"Cannot convert '%' to a numeric",**
          "type": "Sap.Data.SQLAnywhere.SAException",
          "stacktrace": "   at Sap.Data.SQLAnywhere.SACommand._ExecuteReader(CommandBehavior commandBehavior, Boolean isExecuteScalar, Boolean isBeginExecuteReader)\r\n   at Sap.Data.SQLAnywhere.SACommand.ExecuteDbDataReader(CommandBehavior behavior)\r\n   at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)\r\n   at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.<reader>b__c(DbCommand t, DbCommandInterceptionContext`1 c)\r\n   at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)\r\n   at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext)\r\n   at System.Data.Entity.Internal.InterceptableDbCommand.ExecuteDbDataReader(CommandBehavior behavior)\r\n   at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)\r\n   at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)"

if I replace my code with

from a in db.ActiveLoginKeys   
where a.lok_key == key
select a

this works fine

asked 04 Dec '15, 07:40

GeordiePigeonOwner's gravatar image

GeordiePigeo...
41113
accept rate: 0%

edited 04 Dec '15, 08:21

Martin's gravatar image

Martin
9.0k130169257

1

Hmm. found my problem. I'm trying to use the new ef6 drivers (which are great by the way) with an older legacy versioned DB of sybase.

is there any way I can get the SQL to generate correctly for these older db's?

(07 Dec '15, 08:37) GeordiePigeo...

The setup steps for EF6 suppport are a little different than before.

For one thing there is an extra /v EF6 required that wasn't before.

If that isn't the issue you might want to verify the SQL as it arrives at the server. Adding the -zr SQL+HOSTVARS switch to the server cmdline you should be able to determine what is causing the parser error. Please share what you find out.

permanent link

answered 04 Dec '15, 14:43

Nick%20Elson%20SAP%20SQL%20Anywhere's gravatar image

Nick Elson S...
7.3k35107
accept rate: 32%

Yeah without the EF6 switch I cannot run any queries against the DB. I set it up with the /v ef6 switch after days of searching.

This is an entirely different problem. Where using

a == "SomeValuw" in linq statements work fine but

.contains("somevalue") does not.

it's as if the SQL being generated is incorrect.

interestingly .contains("somevalue".ToString())

will work but that is not ideal and is not workable when using an OData Dataservice.

(07 Dec '15, 05:20) GeordiePigeo...
Comment Text Removed

Anything helpful from your request logging ?

(07 Dec '15, 19:10) Nick Elson S...
1

Hmm. found my problem. I'm trying to use the new ef6 drivers (which are great by the way) with an older legacy versioned DB of sybase.

is there any way I can get the SQL to generate correctly for these older db's?

(08 Dec '15, 05:26) GeordiePigeo...
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×240
×5

question asked: 04 Dec '15, 07:40

question was seen: 1,941 times

last updated: 08 Dec '15, 05:26