which sqlcedatareader method should I call for a numeric field?

I am developing a sql server 2005 ce appliaction. I have a numeric(18,10) 
filed in my db table.
When I call oReader.GetDouble(0) after oCmd.ExecuteReader() and 
oReader.Read(), I got a sql exception: invalidCastException.

So I am confusing... Which other method should I call for numeric field than 
GetDouble()?

Thank you in advance. 


0
newsgroup
7/13/2010 10:28:53 AM
sqlserver.programming 1873 articles. 0 followers. Follow

2 Replies
662 Views

Similar Articles

[PageSpeed] 9

> So I am confusing... Which other method should I call for numeric field 
> than GetDouble()?

SQL Server numeric and decimal data types map to a .Net decimal.  See 
http://msdn.microsoft.com/en-us/library/4e5xt97a(VS.80).aspx for a complete 
list.

-- 
Hope this helps.

Dan Guzman
SQL Server MVP
http://weblogs.sqlteam.com/dang/

"newsgroup" <newsgroup@163.com> wrote in message 
news:OlrHQZnILHA.1016@TK2MSFTNGP06.phx.gbl...
> I am developing a sql server 2005 ce appliaction. I have a numeric(18,10) 
> filed in my db table.
> When I call oReader.GetDouble(0) after oCmd.ExecuteReader() and 
> oReader.Read(), I got a sql exception: invalidCastException.
>
> So I am confusing... Which other method should I call for numeric field 
> than GetDouble()?
>
> Thank you in advance.
> 
0
Dan
7/13/2010 12:02:31 PM
Thank you very much.

"Dan Guzman" <guzmanda@nospam-online.sbcglobal.net> 
??????:323DE851-D0AD-4477-918D-8DC8E05583FB@microsoft.com...
>> So I am confusing... Which other method should I call for numeric field 
>> than GetDouble()?
>
> SQL Server numeric and decimal data types map to a .Net decimal.  See 
> http://msdn.microsoft.com/en-us/library/4e5xt97a(VS.80).aspx for a 
> complete list.
>
> -- 
> Hope this helps.
>
> Dan Guzman
> SQL Server MVP
> http://weblogs.sqlteam.com/dang/
>
> "newsgroup" <newsgroup@163.com> wrote in message 
> news:OlrHQZnILHA.1016@TK2MSFTNGP06.phx.gbl...
>> I am developing a sql server 2005 ce appliaction. I have a numeric(18,10) 
>> filed in my db table.
>> When I call oReader.GetDouble(0) after oCmd.ExecuteReader() and 
>> oReader.Read(), I got a sql exception: invalidCastException.
>>
>> So I am confusing... Which other method should I call for numeric field 
>> than GetDouble()?
>>
>> Thank you in advance.
>> 


0
newsgroup
7/14/2010 1:21:35 AM
Reply:

Similar Artilces:

Help with calling some VB.NET code...comments appreciated
Hi, I'm very new to VBScript but can write C# and VB.NET. I want to write .vbs file that calls the following code below (all it does is insert an event folder into the event log) Problem is though I don't know how to do this exactly. Can anyone provide some code sampels as how to call this or incorportate it into a .vbs? Would agreatly appreciate any examples/code-samples/ suggestions etc.... Much thanks, Al. **** VB.NET Example *** Public Sub Main() Dim eventLogName As String = "LogTest14" WriteToReg(eventLogName) End Sub Private Su...

2 calls (month and year) to be combined as date in single cell
I want to use 2 combo boxes on a VBA form, one to specify a month, th other to specify a year. I want Excel VBA to take these two pieces o information (month and year) and put them as a date into *one singl cell* in the format "December 2004 -- Message posted from http://www.ExcelForum.com Hi, Easy. Say your target, or LinkedCell, for Month is cell G1 (December); and the target for your Year combo box is G2 (2004);You want the final result in A1. A1 should read =G1 & " " & G2 jeff >-----Original Message----- >I want to use 2 combo boxes on a VBA form, o...

History when changing status fields
On selected status fields it should be possible to review the change of the status in a history table. We need to know the date when a project was promoted to the next level. It is interesting to know how much time is spent on different project levels. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I A...

Query where 3 Fields must contain same value
I would like to write a query that pulls records where the value in 3 different Columns is the same. Example: Return records where each field below contains same value Return below records Field1 | Field2 | Field3 | 150 150 150 Do not return rows like below Field1 | Field2 | Field3 | 175 26 15 -- Brian Conner Message posted via SQLMonster.com http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-programming/200911/1 WHERE Col1 = Col2 AND Col2 = C...

Creating flags for certain fields in working Form
Hello, What is the best way to add a flag for specific fields? For example, Field A has a value and depending on the value, the flag could change be a choice such as Yes Or No or even changing the color of that specific cell in the table. Any advice much appreciated in advance. -- Best regards, Donald Ramer donaldramer@comcast.net You and I may not mean the same thing by "flag". If you want formatting changes depending of field value, take a look at "Conditional Formatting". -- Regards Jeff Boyce www.InformationFutures.net Microsoft Office/Access MVP http://m...

Calling a stateful web service
Hi, I need to call a stateful JAVA web service in .NET. Anyone know how it's done? Thanks __________ Information from ESET NOD32 Antivirus, version of virus signature database 4627 (20091121) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com for WS-Address support see: http://msdn.microsoft.com/en-us/library/cc540766.aspx or you use the WCF 4.0 beta. it has a discovery service that supports WS-Address. -- bruce (sqlwork.com) Pavel Yosifovich wrote: > Hi, > > I need to call a stateful JAVA web servic...

PreTranslateMessage in the DLL is not called
Hi there. I have a strange thing in my code. I have a class which is derived from CEdit. In that class there is a PreTranslateMessage method. It is called when I compile this class in the Exe. But it is not never called when I compile this class as a DLL and load it dynamically by LoadLibrary and use the class. Please do you have any ideas what is wrong there? What is the difference of using derived class as a exe or as a dll? Thanks! German Koninin Is it a Regular DLL? Is the CEdit derived object in a modeless dialog? --- Ajay German Koninin wrote: > Hi there. > I have a stra...

If Then
I'm relatively new to Access and am trying to build some intelligence into a database I've got. What I'd like to do is have the users select a loan type from a drop down box, and if their choice is one of 2 different types (there are 5 types all together), have it automatically check a checkbox in a different field. So, can I do an if then on one field and it's results effect a different field? I'd love any suggestions! Thanks in advance... On Tue, 24 Nov 2009 16:57:01 -0800, SBecker wrote: > I'm relatively new to Access and am trying to build so...

Remove Unused fields from Advanced Find (Microsoft CRM 3.0)
I am wondering if anyone knows how to remove the unused fields from advanced find so that users don't have to see them. I know I can update the display names for the unused fields to start with "z-not used-<fieldname>" so they show up at the bottom of the advanced find list of fields. Does anyone know if there is away to have advanced find just not show all the out of the box fields that we do not use. Is there a way to modify the object XML and then import it in so it only shows the fields I want to show and allow users to search on instead of all the fields. Tha...

Can No Longer Add Attributes (custom fields) In MSCRM 3.0 SBE
I have been doing a lot of customizing and the past few days I have found that while I can add new accounts and contacts I can no longer add new fields or modify existing fields. I have MSCRM 3.0 SBE with Rollup 1 and are using SQL 2005. I have about 140 GB of free hard disk space on the server but when I try save the field I have just defined I get a message saying that "An error has occurred. For more information contact your system administrator." If I go to MIcrosoft SQL Server Management Studio and click on properties for the Microsoft CRM DB it says that the space avai...

How to create a record after filling the fields
Hi I would like to know how to create a record (After filling the fields) without creating a new blank record(newrec). I need to create a record after I fill the fields and when I press ENTER Access needs to give ID for this record .(Whithout creating a new blank record afterwards). Thanks In the event code of the control on the form that you want to cause the record to be saved: Me.Dirty=False HTH -- -Larry- -- "Chipcom" <bz1977@gmail.com> wrote in message news:4e93e98d-d093-4389-996e-df8ddfa974b6@o6g2000hsd.googlegroups.com... > Hi > > I would like to kn...

If Statement based on Alpha or Numeric
I am trying to do an if statement based on whether a character is numeric or alpha. e.g. I have the following spreadsheets: A 1 01-BHZ 2 01-049 Basically what I am wanting to do is an if statement based on a mid formula. i.e. if mid(A1,4,1) is numeric then "Numeric", if not "Alpha" Is there a formula I can use? Is it a public function with a bit of VBA? Please help Regards, Ryan =IF(ISNUMBER(1*MID(A1,4,1)),"Numeric","Alpha") HTH Jason Atlanta, GA >-----Original Message----- >I am trying to do an if statement based on whether a c...

Calculated Field Issue
I have three tables, Entries, Jobs and Parts. These three tables are related with one-to-many relationships, from left to right. i.e. one entry - many jobs one job many parts Among the other fields, in the parts table there is quantity and price, and in the jobs table labour. Additionally, I created a 3-level report where I calculated, using a calculated field, the total of each job using the expression: =[Labour]+Sum([Quantity]*[Price Sold]) Now, I want to create another calculated field to sum up all the job totals for each entry. I tried the following expression, but it displays a m...

Using a command button to open an image based on field data
Hello. I have a form with a command button on it. This form is linked to a query with a field called "ID". What I am trying to do is make it so that when the user clicks on the command button, a separate form (frm_Image)pops up with the corresponding picture to field ID. I have the images in a folder on my C: drive. Any help on this is most appreciated. I'm going to do a little experimenting now.... Check out openargs in the VB help section. HTH Damon <rsfishel@gmail.com> wrote in message news:1174046910.691059.94060@e1g2000hsg.googlegroups.com... > Hello. I ...

how2: show contact name and phone fields in task list
It would be useful if I could display contact name and phone number fields in my task list. In Simple View I've used Field Chooser to insert these columns into the table .. but alas! the fields are blank. Can I do what I want to do and .. how? thanks Any folder view shows only the data in that folder, even though Outlook lets you think otherwise by allowing you to add fields from different types of items in the folder. You may be able to accomplish what you want, however, with a little custom VBA code. For an example, see http://www.outlookcode.com/codedetail.aspx?id=566 -- Su...

Trying to update a field
Hello all, I have created a query that has project details such as the award cost and want to determine the total cost of the project by bringing in the total cost of change orders (I totalled these as a sum in another query). On Fri, 16 Apr 2010 09:38:03 -0700, Brian T <BrianT@discussions.microsoft.com> wrote: >Hello all, > >I have created a query that has project details such as the award cost and >want to determine the total cost of the project by bringing in the total cost >of change orders (I totalled these as a sum in another query). Correct the...

OWA Login page has no password field
Hey, I've got a small problem I'm having trouble finding a solution to. I have implemented OWA for our company's Exchange 5.5 server. Everything works fine except when I go to the log on screen, I have the field where I am to enter my mail box name. Since there is no place enter a password, I am prompted with a Windows authentication box. I want my users to either be able to enter thier user name and password on the welcome screen, or by pass that and go straight to the Windows log on box. I know it can be done, just not sure how to do it. Thanks! ...

Date field inserting time into workflow
I have created 2 attributes, Start Date & End Date. They are datetime field but Date only on the form. When I attempt to use the fields in a workflow, specifically creating an email activity, it also inserts a time stamp for both the Start & End Dates. It looks like this: 03/21/2007 11:00 PM (GMT-05:00) Eastern Time (US & Canada) - 03/21/2007 11:00 PM (GMT-05:00) Eastern Time (US & Canada) If I created the attribute as a Date Only, why is it assigning a timestamp? Can I eliminate that timestamp from the workflow? Melissa Unfortunately the storage is always datetime...

Fomatting amount fields w/ proper currency symbol using SQL Report
Entered in a transaction using currency id Z-EURO. Standard GP report pulls the correct currency symbol. When creating this report using SQL Reporting Services the Currency Symbol for the Amounts are pulling in '$' and not the EURO symbol. How would I accomplish formatting amount fields with the proper currency i.e (EURO, YEN or USD)? ...

Field shows up on saved form not inital form
I have created a new picklist field in the schema manager - published it and inserted it on the lead form. When I choose to create a new lead the field does not show up. Once I save the new lead the field show up on the saved form. How can I get this field to be present when I start an new Lead? thanks, -- JPM it finally showed up on the form. "jmadigan" wrote: > I have created a new picklist field in the schema manager - published it and > inserted it on the lead form. When I choose to create a new lead the field > does not show up. Once I save the new lead th...

Check to see if a specific field exist on form
Hi, I want to check if a field called Owner exist on the form If FieldOwnerExist then ZZNAV_OWNER = Screen.ActiveForm![SubForm].Form![Owner] end if Could someone advice SF Hi SF, I think you are asking if the field Owner has a value (meaning that it's not null or empty). If I have not understood please let me know. To do that you can use: If not isnull(me.subform.form.owner) if this code is on the form with the field called Owner. If not isNull(me.subform.form.owner) then zznav_owner = me.subform.form.owner end if As you are using Screen.ActiveForm, this changes things...

Editing Controls of Built-in Fields
I want to import an ACT database into Outlook. I can't import data into user-defind fields, so I want to edit built-in fields to accommodate my data. I don't find any way to change the controls or the data types of built-in fields. Mainly, I want several list (or drop-down) fields, and keyword fields. I even tried creating a new field using the listbox control, thinking I could then choose a different field in properties, but the "list type" in properties is inactive, regardless which field I choose. HELP You can't change the data types of *any* fields, custom...

Blank fields
I have the following criteria in a query: IIf([Forms]![Amend Request (Ref No)]![WorkTypeList]="(All)",[tbl Details]![Work Type],IIf([Forms]![Amend Request (Ref No)]![WorkTypeList]="(Blank)",[tbl Details]![Work Type],[Forms]![Amend Request (Ref No)]![WorkTypeList])) The combo box on the form contains all of the records from the table and where they are null I have replaced with (Blank) in the combo box. I am then trying to filter the query using the (Blank) selection but the query does not return the records where the field is null. Can anyone correct me on this? ...

Acutal mail sent date field
When you Track a mail message in your Outlook inbox, the actual sent date from the mail header is not stored in CRM. The date that is stored is the date the mail message was Tracked in CRM, which may be toally different from the sent date. A CRM system is used to store information about customer contact, and it is important to know when a message is sent to anyone in the organization. It is therefore a highly prioritized wish to have the actual sent date as a separate field in the Activities/History entity. ---------------- This post is a suggestion for Microsoft, and Microsoft responds...

Mapping fields between entities for Onchange events
We currently have mapping between entities (Account to child Contact) that work if you create the child record directly from the parent record. I would like to see a way to explicitly have fields map between entities after they already exist. This goes from Parent to Child and Child to Parent entities. Example: Child Account up to its Parent Account. If an existing Account is edited to label it as a "Customer" type, then the Account's Parent Account should have it's label changed as well. -- Carroll Little Vis.align, LLC 610-692-3290 x3326 www.visalign.com ---------...