I'm having a strange problem. I have an array of strings that I need to separate into separate data members and insert into a SQL database. It all works fine, except for where I convert a string to a decimal and insert that. It works if the decimal has no integer part, (ex: .50), but if there is an integer part, it get NULL. What's even stranger is this, I have two columns that are accepting decimal values. One of the data entries has .00 both columns. One column with be entered as .00 and the other one will be NULL, even though both are exactly the same, just the column name is different. I've double checked everything and my stored procs are correct, data types match and everything. Is there some kind of stupid 'trick' to getting this to work correctly? I've tried using different data types also (double, float, money, etc). If it's a data type that accepts a floating-point type number I've tried it.

Anyone have an suggestions?

Recommended Answers

All 2 Replies

Check the way your decimal columnis defined in SQL server. It's possible you've defined it to not allow values >= 1.0. Use MSDN to reference how to properly specify the column.

Do the same check on your stored procs, they need to match exactly for expected behavior.

I got it figured out. There was a small stupid type-o in one of the values in a stored proc. I must be dyslexic or something, lol.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.