20 DIGIT NUMBER

Discussion forum about all things SqlBase.
FRBhote
India
Posts: 2172
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

20 DIGIT NUMBER

Post by FRBhote » 08 Jan 2015, 09:00

I have a NUMBER field where a 20 digit number is stored. In TD, a select fetches the number perfectly, but in a .net program it is returned in exponential form.

How can I get the same result as TD in .net?

Or can someone give me an idea how to fetch the right and left 10 digits so that they can be concatenated?

Thanks.

Mike Vandine

Re: 20 DIGIT NUMBER

Post by Mike Vandine » 08 Jan 2015, 09:21

How about a sample project?

Mike Vandine

Re: 20 DIGIT NUMBER

Post by Mike Vandine » 08 Jan 2015, 09:21

Oh, and what version of SQLBase and .NET?

FRBhote
India
Posts: 2172
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Re: 20 DIGIT NUMBER

Post by FRBhote » 10 Jan 2015, 09:22

This is the CTD code - any version of .net gets it in exponential form - SB 8.5, but I don't suppose that would make any difference.
You do not have the required permissions to view the files attached to this post.

Mike Vandine

Re: 20 DIGIT NUMBER

Post by Mike Vandine » 12 Jan 2015, 03:33

Hi Feroz,

A small .NET project that shows this would be good as well. I use VS 2010. What version of our .NET driver are you using?

Best regards,

FRBhote
India
Posts: 2172
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Re: 20 DIGIT NUMBER

Post by FRBhote » 12 Jan 2015, 07:11

.net project attached.
You do not have the required permissions to view the files attached to this post.

Mike Vandine

Re: 20 DIGIT NUMBER

Post by Mike Vandine » 12 Jan 2015, 08:46

Hi Feroz,

Thanks for the samples. Once more:

What version of our .NET driver are you using? What version of TD is this sample written with? What version of VS is the project written in?

Thanks!

FRBhote
India
Posts: 2172
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Re: 20 DIGIT NUMBER

Post by FRBhote » 12 Jan 2015, 14:42

TD 2.1 and VS 2007. Try it with any .net driver.

FRBhote
India
Posts: 2172
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Re: 20 DIGIT NUMBER

Post by FRBhote » 12 Jan 2015, 14:52

long.jpg
Sadly SELECT @MOD( X_NUMBER, 1e10) FROM X;
gives:

@MOD( X_NUMBER, 1E10)
=====================
7653693440

Should be 7654321098

The number being:
9876543210987654321098
You do not have the required permissions to view the files attached to this post.

Mike Vandine

Re: 20 DIGIT NUMBER

Post by Mike Vandine » 14 Jan 2015, 06:58

Hi Feroz,

I tried to convert the project to VS2010 and got many errors.

However, the TD application that you sent I was able to run using SQLBase 11.7 and TD6.2 I get the exact same display as you see below.

I then went into SQLTalk after the creation in the TD app and did a select * from x. This showed me the x_number column with the exact same exponent value. I was able to modify the column display size with a 'column 1 width 30;' and the whole number was displayed correctly. So the data is obviously being stored on the database fine, so this isn't actually a SQLBase issue.

With TD, you have two columns that are being displayed. One is a direct result of a select into a 'number' column. This shows (most likely) the same value that you see in the VS application. The second display is from a SalNumberToString function and this shows correctly.

I'm not sure what the maximum is to be shown for a TD 'Number' column, but I think it might be a bit less than 22. :)

I modified the app decreasing the number of digits being inserted until the non-exponential number was displayed. The magic number is 15. Any more than that and you get the exponent.

So, the question at this point is: What settings do you need to make in your VS application to display the whole number?

FRBhote
India
Posts: 2172
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Re: 20 DIGIT NUMBER

Post by FRBhote » 14 Jan 2015, 08:34

That is the question exactly - What settings do I need to make in your VS application to display the whole number?

Attached is a VS 2010 example.
You do not have the required permissions to view the files attached to this post.

FRBhote
India
Posts: 2172
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Re: 20 DIGIT NUMBER

Post by FRBhote » 14 Jan 2015, 08:35

Sorry wrong code earlier.
You do not have the required permissions to view the files attached to this post.

Clifford Bass

Re: 20 DIGIT NUMBER

Post by Clifford Bass » 21 Jan 2015, 03:02

Hi Feroz,

Is there a particular reason you are using the SQLBase OLEDB provider with the .NET OleDB provider instead of the SQLBase .NET provider? That appears to be your problem. The .NET OleDB provider gets the number value as a Double; which drops off the lower digits. If you use the SQLBase .NET provider, it comes through as Decimal; with all the digits intact. Attached is a VB .Net form you can include in a test project to see the difference. The results I get are:

Using SQLBase .NET 11.7.3 provider:
DataReader direct / X_Number = 9876543210987654321098
DataTable / X_Number = 9876543210987654321098

Using SQLBase OLE DB 11.7.3 provider via OleDb .NET:
DataReader direct / CDbl(X_Number) = 9.87654321098765E+21
DataReader direct / CDec(X_Number) = 9876543210987650000000
DataTable / CDbl(X_Number) = 9.87654321098765E+21
DataTable / CDec(X_Number) = 9876543210987650000000

Hope that helps,

Clifford Bass
You do not have the required permissions to view the files attached to this post.

Mike Vandine

Re: 20 DIGIT NUMBER

Post by Mike Vandine » 21 Jan 2015, 03:27

Thanks, Cliff. The reply is greatly appreciated!

Best regards,

FRBhote
India
Posts: 2172
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Re: 20 DIGIT NUMBER

Post by FRBhote » 21 Jan 2015, 05:54

Thank you very much Cliff!

Return to “General Discussion”

Who is online

Users browsing this forum: [Ccbot] and 0 guests