Monday, February 20, 2012
money datatype
value. If i try to enter a null value from my asp page i
am getting error... what i need to do on my sql server
table so it does not error me out. i think, it has
something to do with precision and scale... but I don't
know what.
ERROR:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1:
Incorrect syntax near ','.
ThanksCould you display the string that you are constructing in your application?
Look at this string when the money column is null. I am sure you will know
what's causing the problem. It just looks like you are concatenating
something with NULL and the whole thing becomes NULL.
--
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
What hardware is your SQL Server running on?
http://vyaskn.tripod.com/poll.htm
"eren" <oeren@.calcoastcu.org> wrote in message
news:004c01c37d37$d3bd55e0$a401280a@.phx.gbl...
i have money a datatype in my table and it allows null
value. If i try to enter a null value from my asp page i
am getting error... what i need to do on my sql server
table so it does not error me out. i think, it has
something to do with precision and scale... but I don't
know what.
ERROR:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1:
Incorrect syntax near ','.
Thanks|||This looks like a syntax error in the statement generated by the asp page.
Verify that the statement is correct and that nulls are handled correctly by
the asp code generating the statement.
Shaun
"eren" <oeren@.calcoastcu.org> wrote in message
news:004c01c37d37$d3bd55e0$a401280a@.phx.gbl...
> i have money a datatype in my table and it allows null
> value. If i try to enter a null value from my asp page i
> am getting error... what i need to do on my sql server
> table so it does not error me out. i think, it has
> something to do with precision and scale... but I don't
> know what.
> ERROR:
> Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
> [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1:
> Incorrect syntax near ','.
> Thanks
Money data type
I have a Price column which has 'money' as the data type.
Then I populated some data into the table. I enter '1.00' in the Price column, then I used the following code to get the data:
Label2.Text = "$" + dataSet1.Tables["products"].Rows[0]["price"].toString();
However, the price is displayed as "$1.0000". But I believe it should display "$1.00". So how can I get rid off the two zeros at the end.
regardsUse string.format("{0:c}", yourvalue)
This will format it in the currency used by your web server.
If you want more control, use "$" & string.format("{0:#,##0.00}", yourvalue)|||Hi PDraigh
I think u may have goven me VB code, actually I was using C#..
string.format("{0:#,##0.00}", yourvalue)
In the above code, what does 'string' represent|||I assume it would still work. 'string' is just the System.String. It's not a variable or object I declared. "{0:#,##0.00}" is the string formatting instruction and 'yourvalue' is just whatever value you want to format using the instruction. Try it, I think it would work in C#, but I don't use C#, so not sure|||yep
String and Format should be capital, such as String.Format("{0:#,##0.00}", price);
However, I still get 2.0000 istead of 2.00|||try,
Label2.Text = String.Format("{0:$##,##0.00}",dataSet1.Tables["products"].Rows[0]["price"]);
or
Label2.Text = String.Format("{0:c}",dataSet1.Tables["products"].Rows[0]["price"]);