I have lot of columns in database like
Price Numeric(5,2)
Street Character(30)
For UI display and validation I need to retrieve width and for numeric
properties, decimal places of corresponding DbLinq property.
pgsqlmetal generates code for column properies without width and decimal
places like
[Column(Name = "price", DbType = "numeric", CanBeNull = false)]
public decimal Price {
....
Which is best way to obtain width and decimal places of property:
1. Is there standard attributes which can be added to property ?
2. Should DbType attibute be DbType = "numeric(5, 2)" or
DbType="charact er(30)" ?
3. Should I query database metadata directly using ADO .NET ?
Andrus. 3 1695
Well, you could add your own attribute for your UI purposes. Other
than that, this is probably best directed at a pgsqlmetal/dblinq group
(or the blog), as it is quite specific to that technology.
Marc
Well, you could add your own attribute for your UI purposes. Other
than that, this is probably best directed at a pgsqlmetal/dblinq group
(or the blog), as it is quite specific to that technology.
Marc,
this may be general LinQ-SQL issue as well.
As MSDN states Column DbType attribute contains full server data type.
So I must parse DbType value manually to get field width and decimal places.
This is the only way, LinQ-SQL is not capable to return such important
instruction directly.
Andrus.
Andrus,
I wouldn't go about parsing the string in the data type. Personally, I
would do a query against the sys.columns information view to get the column
information in a format that is more easily dealt with.
Assuming that the structure of the tables doesn't change over the
lifetime of your app, you would only have to select this once, and then you
could cache the data.
Of course, the attribute will tell you which column to get the
information for.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Andrus" <ko********@hot .eewrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
>Well, you could add your own attribute for your UI purposes. Other than that, this is probably best directed at a pgsqlmetal/dblinq group (or the blog), as it is quite specific to that technology.
Marc,
this may be general LinQ-SQL issue as well.
As MSDN states Column DbType attribute contains full server data type.
So I must parse DbType value manually to get field width and decimal
places.
This is the only way, LinQ-SQL is not capable to return such important
instruction directly.
Andrus. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: John Bentley |
last post by:
John Bentley:
INTRO
The phrase "decimal number" within a programming context is ambiguous. It could
refer to the decimal datatype or the related but separate concept of a generic
decimal number. "Decimal Number" sometimes serves to distinguish Base 10
numbers, eg "15", from Base 2 numbers, Eg "1111". At other times "Decimal
Number" serves to differentiate a number from an integer. For the rest of this
post I shall only use either...
|
by: Carl G |
last post by:
I am storing a 0.000 a System.Decimal in a DataRow.
On retrieval the value is only 0 without the three decimal places.
It looks like the Get property returns System.Decimal.Zero, but
why????
I can't figure out why the design is so that the DataRow "alters" the
value entered.
In my application a decimal column in a row of a specific table has a
fix number of decimal places according to certain premises. The
|
by: italia |
last post by:
I changed the Fieldsize Property from text to Long Integer and Decimal
Places = 6.
I had decimals in the original field. But after the transfer, the
digits after the decimals are gone.
Now even after I have change the Fieldsize propert to Decimal with
Scale = 2, the digits after the decimal are not seen.
For eg. If the text was 16.27. After I changed to long integer, it
|
by: paulquinlan100 |
last post by:
Hi
I have a couple of calculated fields in a report, i've set the Decimal
Places property to 0 and the format to General Number, however when
previewing the report it still comes up with a number with up to 8
decimal places!
Any suggestions how to overcome this problem gratefully received!
Paul
|
by: Hank |
last post by:
Hello,
I'm running Access 2000. I would like to know if its
possible to use VBA code to determine how many decimal places are
specified for each table field.
Currently I loop throught the Tables Collection, the Tables
Fields Collection, and then the Field Properties Collection but I do
not see what I need. I don't want to change the setting. I just want
to make a list of the decimal place setting for each "Single" field in
| |
by: hunslair |
last post by:
This is a really basic question. I am taking a teach yourself
beginners course on Access 2003 and have run into a road block on one
practice. In a select query, I have created a simple calculation
field.
Markup:(-)/
which is to formatted as Percent with 0 Decimal places.
When I click into the Format box is am offered
|
by: =?Utf-8?B?S3VuYWwgUGF0ZWw=?= |
last post by:
I have a DataTable with Column DataType as Double I just want to show data in
C# datagrid with two decimal places
which property do I set for DataColum of DataTable and How?
Thanks
|
by: Andrus |
last post by:
How to create format string for decimal data type
which shows blank for zero and default format otherwize ?
I tried format string "f;f;#" but this shows f for nonzero numbers.
Andrus.
using System.Windows.Forms;
|
by: NeoPa |
last post by:
I have noticed this over many versions of Access and was wondering if anyone could throw any light on why this seems to happen.
It seems that when designing a QueryDef in the QBE grid and specifying the Properties of an individual numeric field, the Decimal Places property is often invisible. From observation this seems to occur when the Field: is set to a calculation of some form (rather than a simple field from one of the TableDefs). ...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |