Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Benefits of SqlTypes?

Benefits of SqlTypes?

Scheduled Pinned Locked Moved C#
questionperformance
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sixefftee
    wrote on last edited by
    #1

    i have simple question what are the benefits of using SqlTypes (especially regarding performance). I know there is the IsNull property but what else?

    H 1 Reply Last reply
    0
    • S sixefftee

      i have simple question what are the benefits of using SqlTypes (especially regarding performance). I know there is the IsNull property but what else?

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      There is no Type called SqlTypes in the BCL. Do you mean the SqlType enumeration? You should use this when using parameterized queries and adding DataColumns to ensure that data is represented correctly, as well as for design-time purposes and using classes like the SqlCommandBuilder. This helps determine what type of data is represented. Imagine if all properties on every class were simply defined as object. How do you know what type of data to assign to a property in such a case? This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles] [My Blog]

      C 1 Reply Last reply
      0
      • H Heath Stewart

        There is no Type called SqlTypes in the BCL. Do you mean the SqlType enumeration? You should use this when using parameterized queries and adding DataColumns to ensure that data is represented correctly, as well as for design-time purposes and using classes like the SqlCommandBuilder. This helps determine what type of data is represented. Imagine if all properties on every class were simply defined as object. How do you know what type of data to assign to a property in such a case? This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles] [My Blog]

        C Offline
        C Offline
        Charlie Williams
        wrote on last edited by
        #3

        I think he is referring to the various structs defined in the System.Data.SqlTypes namespace. Charlie if(!curlies){ return; }

        H 1 Reply Last reply
        0
        • C Charlie Williams

          I think he is referring to the various structs defined in the System.Data.SqlTypes namespace. Charlie if(!curlies){ return; }

          H Offline
          H Offline
          Heath Stewart
          wrote on last edited by
          #4

          Perhaps, but that's why one should be a little more descriptive. To the original poster, the documentation for the System.Data.SqlTypes (if that is, in fact, what you meant) explains it quite clearly:

          The System.Data.SqlTypes namespace provides classes for native data types within SQL Server. These classes provide a safer, faster alternative to other data types. Using the classes in this namespace helps prevent type conversion errors caused in situations where loss of precision could occur. Because other data types are converted to and from SqlTypes behind the scenes, explicitly creating and using objects within this namespace results in faster code as well.

          This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles] [My Blog]

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups