RE: To cast or not to cast?



http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfsystemdatasqldbtypeclasstopic.asp

UInt32: Int will do. Signed and Unsigned integers are actually the same;
just cast them to the right type.
UInt16: SmallInt, see warning above
Byte: TinyInt
BioAPI_*: look up underlying type definition and use it. Enums are Int32 by
default.
IntPtr: it's Int32, so store it as Int.

Note, however, it's probably pointless to store pointers in the data base.
Pointer itself is not important, most likely you need to store whatever
it's pointing to.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
> From: "Jeremy" <jezonline@xxxxxxxxxxx>
> Subject: To cast or not to cast?
> Date: Fri, 8 Apr 2005 00:21:17 +0100
> Lines: 25
> X-Priority: 3
> X-MSMail-Priority: Normal
> X-Newsreader: Microsoft Outlook Express 6.00.2800.1478
> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1478
> Message-ID: <umEpDi8OFHA.3880@xxxxxxxxxxxxxxxxxxxx>
> Newsgroups: microsoft.public.dotnet.framework.compactframework
> NNTP-Posting-Host: host-84-9-101-26.bulldogdsl.com 84.9.101.26
> Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
> Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.compactframework:26546
> X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
>
> Hi,
>
> I'm trying to convert the following types into types that I can insert in
an
> SQL database (via a webservice). None of these however are accepted by Sql
> (i.e., there is no OleDbType for them). I could only use integer type for
> UInt32, that's about it. I'm totally unsure about the other types. What
I've
> tried doing so far is casting them prior to sending them to the
webservice.
> When inserting them I get errors though. Would anyone know/could point me
to
> types that I could use? Any help would be really appreciated, i'm lost!
>
> Thanks so much!
>
>
> System.UInt32 Length;
> System.Byte HeaderVersion;
> BioAPI_BIR_DATA_TYPE Type;
> System.UInt16 FormatOwner;
> System.UInt16 FormatID;
> System.Byte Quality; /*INT8 BioAPI_QUALITY*/
> BioAPI_BIR_PURPOSE Purpose;
> BioAPI_BIR_AUTH_FACTORS FactorsMask;
> System.IntPtr BiometricData;
> System.IntPtr Signature;
>
>
>

.



Relevant Pages

  • Re: Newbie question about malloc
    ... "Implicit int" no longer exists in C. ... It's generally recommended to NOT cast the return from malloc. ... %d can never be the correct format specifier for a size_t. ... C99 introduced %zu for this purpose, ...
    (comp.lang.c)
  • Re: what will happen after i use free()???
    ... Inserting a cast before malloc is not needed, ... 56 bits while int is only 48 bits. ... So casting that value requires some ... Use cast only if you are absolutely sure that yor really needs the ...
    (comp.lang.c)
  • Re: about the array
    ... 3- If you cast to the wrong type by accident, ... are malloc and free. ... the compiler should issue a diagnostic - gcc ... unknown set of arguments, and return an int. ...
    (comp.lang.c)
  • Re: Simple Casting Question
    ... only in the form (int to float),,, ... or just casting identical types, so I hope that I can avoid some ... None of the conversions you describe ... In most cases where a cast is used, ...
    (comp.lang.c)
  • swap using pointers
    ... int swap; ... incompatible pointer type ...
    (comp.lang.c)