databinding question

  • Thread starter Thread starter dwight0
  • Start date Start date
D

dwight0

I have a textbox databinded to a dataset (in c#).
The dataset is filled by a dataadapter, which connects to field in an
sql server database.
The field in the database is of type money.
In the application, if I retrieve a row of data, such as 40.00, it
comes back 40.0000.
I need just two digits.
I can't find any option to set the precision.
Im not sure if this would be in the dataset, the database, or where.
Any ideas?
 
I'm fairly certain you'd need to actually do it on the form. I've personally
never done any data binding to text controls, but my guess is you could
handle it in the TextChanged event. Really, you should probably use some
sort of masked edit control, but the TextChanged event should serve your
needs.

Pete
 
Cast it with SQL into string (than take these two digits)and than cast it
again to number, you can do it using CommandText in OleDataCommnd (In
DataAdapter SELECTCommand)or SQLDataCommand,
 
I finally figured it out.
If i set my datatypes from money to decimal in sql server, it lets me
change the "scale" and "precision" unlike the money datatype. i just
leave the precision alone and set the scale to two. i dont see why
anyone would use the money datatype.
 
Back
Top