definining currency in ADO.NET 2.0

G

Guest

I have a procedural question - in ADO.NET 1.1 when I created DataSets from an
XSD schema I would create a SimpleType named "Money" and set the
FractionDigits to 2. Thus, my USD fields were always correctly formated
$1.23.

In ADO.NET 2.0 (at least from the IDE) I don't seem to be able to specify a
simple type in my schema, or much of anything else for that matter. What is
the recommended method for locking dataset values to currency format?

Thanks in advance, I apologize but some of the changes ADO.NET 2.0 aren't
making sense yet.

Andre Ranieri
 
G

Guest

So, then, what's the solution for enforcing decimal accuracy constraints like
you'd want to see in USD currency?

Thanks in advance for any suggestions.

Andre
 
G

Guest

So, what I'm gathering is that there's no way to enforce data constraints or
decimal precision at the middle tier (dataset) level.

The client's back-end database is MS-Access and I can't modify their
existing data schema for this reporting project, only pull data from the
database.

Since the datagridview control doesn't seem to offer a .Format("c") option
(or something similiar) I'm gathering that my best option is to fill the
strongly typed datatable, then iterate through every row and round the values
off before binding the table to the datagrid. This seems like an awful lot
of processing resources thrown at a relatively common task.

Any suggestions are always welcome.

Andre Ranieri
 
E

Earl

Noooooooooo ... if you are just needing to format the datagridview, simply
set the default format for the column to currency:

dgv.Columns["Cost"].DefaultCellStyle.Format = "c";
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top