From Friday, January 17th 11 PM CDT (January 18th 5 AM UTC) through Saturday, January 18th 11:30 AM CDT (January 18th 5:30 PM UTC), ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Decimal Place issue - unable to insert into Database

Solved!
Go to solution

I have a really simple problem and I've tried a couple of solutions found elsewhere but just can't seem to get this right.

 

I have two values, which are initially imported via a Database query (SQL), then the value written into a DBL Control.  Once altered, I then want to put it back using Database Insert and create a new record.  My problem lies with once I've changed the value, and pressed the button, the value sent to the Database isn't the formatted value I need (and I have tried converting to a string, setting the width, setting the display format of the control - nothing seems to work).

 

Screenshot attached shows the resultant data, it errors as my SQL column is set to Decimal(6,2).

 

All I want is a value like 1234.56

 

Am I just being really stupid here?!

0 Kudos
Message 1 of 15
(5,579 Views)

What is the error message?

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 2 of 15
(5,541 Views)
Possible reason(s):
ADO Error: 0x80040E57
Exception occured in Microsoft OLE DB Provider for ODBC Drivers: [Microsoft][ODBC SQL Server Driver][SQL Server]Arithmetic overflow error converting float to data type numeric. in NI_Database_API.lvlib:Rec Create - Command.vi->NI_Database_API.lvlib:Cmd Execute.vi->NI_Database_API.lvlib:DB Tools Insert Data.vi->Update CdV Factor.vi
0 Kudos
Message 3 of 15
(5,530 Views)

Are your column names [1] and [10]?  I doubt that special characters are allowed.  Give your columns an actual name with alpha characters. 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 4 of 15
(5,516 Views)

Yes they are called 1 & 10, I've used the square brackets to ensure they a relative name, not an actual value, but I will test that theory, but I usually write data back to this table by other methods and have no issues.

0 Kudos
Message 5 of 15
(5,513 Views)

@aputman wrote:

Are your column names [1] and [10]?  I doubt that special characters are allowed.  Give your columns an actual name with alpha characters. 


Having amended the table and changed the column names to the words "One" and "Ten", I can confirm this still doesn't resolve the issue.  It was worth a try but was 99.9% sure this wasn't the issue, but having learned from LabVIEW experience, sometimes expect the unexpected!

0 Kudos
Message 6 of 15
(5,458 Views)