Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

Hi,

I am connecting to a SQL Anywhere 17 database using the oledb provider SAOLEDB. I am using vb.net (2005) and can create a connection, read, write and execute stored procedures. But it seems that there are some issues with some of the datatypes being retrieved.

  1. When we ran a select statement to get a GUID, it returned null in vb.net using oledb: SELECT newid() Then when I cast it, then the value came through. SELECT CAST(newid() AS VARCHAR(255))

  2. When we ran a select statement which returned 2 time fields: Select SessionID, StartTime, EndTime from MySession It returned the message as an error: "The data value could not be converted for reasons other than sign mismatch or data overflow. For example, the data was corrupted in the data store but the row was still retrievable." Again CAST fixes this problem.

We have upgraded SQL Anywhere from 10 to 17 and have started getting these errors.

I appreciate that dotnet 2005 is old, have these datatypes changed? Apart from CAST or turning off CONVERSION_ERROR is there anything else I might be able to do?

Thanks Sully

asked 06 Dec '16, 11:35

sullyo's gravatar image

sullyo
56224
accept rate: 0%


For time and timestamp with time zone data types, try using the "Delphi=Yes" connection parameter. Newer versions of the provider implement time and timestamp with time zone using modern types like DBTYPE_DBTIME2 and DBTYPE_DBTIMESTAMPOFFSET. See http://dcx.sap.com/index.html#sqla170/en/html/3bd9b5276c5f101494da9a0931d44c40.html.

Not sure what the GUID issue is all about.

permanent link

answered 07 Dec '16, 09:26

JBSchueler's gravatar image

JBSchueler
3.3k41564
accept rate: 19%

edited 07 Dec '16, 09:30

I tried executing "select newid()" using a test script and it worked fine. Did not need to use any special options.

cscript test.vbs -q "select newid()"

Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

newid()
{CA760185-54F4-4A05-9F81-E43D9D10D8DB}
rowCount = 1
permanent link

answered 07 Dec '16, 09:54

JBSchueler's gravatar image

JBSchueler
3.3k41564
accept rate: 19%

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:

×10

question asked: 06 Dec '16, 11:35

question was seen: 2,602 times

last updated: 07 Dec '16, 09:54