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. SQL Data type validation

SQL Data type validation

Scheduled Pinned Locked Moved C#
databasesql-serversysadminhelpquestion
5 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.
  • J Offline
    J Offline
    jonhbt
    wrote on last edited by
    #1

    I need to create a method that accepts a string as a parameter and checks whether this parameter is a valid SQL Server datatype or not. Can someone help please? thanks

    H P 2 Replies Last reply
    0
    • J jonhbt

      I need to create a method that accepts a string as a parameter and checks whether this parameter is a valid SQL Server datatype or not. Can someone help please? thanks

      H Offline
      H Offline
      himanshu2561
      wrote on last edited by
      #2

      Hi, Change the method parameter from String to SqlDbType.

      himanshu

      1 Reply Last reply
      0
      • J jonhbt

        I need to create a method that accepts a string as a parameter and checks whether this parameter is a valid SQL Server datatype or not. Can someone help please? thanks

        P Offline
        P Offline
        PIEBALDconsult
        wrote on last edited by
        #3

        How about System.Enum.Parse ( typeof(System.Data.SqlDbType) , "datetime" , true ) ?

        J 1 Reply Last reply
        0
        • P PIEBALDconsult

          How about System.Enum.Parse ( typeof(System.Data.SqlDbType) , "datetime" , true ) ?

          J Offline
          J Offline
          jonhbt
          wrote on last edited by
          #4

          thanks it worked fine for my application

          P 1 Reply Last reply
          0
          • J jonhbt

            thanks it worked fine for my application

            P Offline
            P Offline
            PIEBALDconsult
            wrote on last edited by
            #5

            Glad to be of service.

            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