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. Database & SysAdmin
  3. Database
  4. how to know the datatype of a field in a database?

how to know the datatype of a field in a database?

Scheduled Pinned Locked Moved Database
databasehelpcsharptutorialquestion
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.
  • K Offline
    K Offline
    kalaveer
    wrote on last edited by
    #1

    hi, in the sql we have user_tab_coloumns to know the datatype of a field in a table by properly querying but my problem is i am using an oledbconnection in C# to connect to an access database and i want to know the datatype of a field of a table in that perticular database how to do that? pls help me. thanx in advance.

    A S 2 Replies Last reply
    0
    • K kalaveer

      hi, in the sql we have user_tab_coloumns to know the datatype of a field in a table by properly querying but my problem is i am using an oledbconnection in C# to connect to an access database and i want to know the datatype of a field of a table in that perticular database how to do that? pls help me. thanx in advance.

      A Offline
      A Offline
      andyharman
      wrote on last edited by
      #2

      How about the DbConnection.GetSchema method?

      K 1 Reply Last reply
      0
      • A andyharman

        How about the DbConnection.GetSchema method?

        K Offline
        K Offline
        kalaveer
        wrote on last edited by
        #3

        how that helps?:confused:

        A 1 Reply Last reply
        0
        • K kalaveer

          how that helps?:confused:

          A Offline
          A Offline
          andyharman
          wrote on last edited by
          #4

          It allows you to use c# to get the details of a database table, and its columns. Isn't that what you asked for?

          1 Reply Last reply
          0
          • K kalaveer

            hi, in the sql we have user_tab_coloumns to know the datatype of a field in a table by properly querying but my problem is i am using an oledbconnection in C# to connect to an access database and i want to know the datatype of a field of a table in that perticular database how to do that? pls help me. thanx in advance.

            S Offline
            S Offline
            ScottM1
            wrote on last edited by
            #5

            Check out OleDbDataReader.GetDataTypeName(index) or OleDbDataReader.GetFieldType(index) Never tried it myself but should work ;)

            There are 10 types of people in the world, those who understand binary and those who dont.

            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