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. Get Table Fields Description

Get Table Fields Description

Scheduled Pinned Locked Moved C#
databasequestionsql-serversysadmin
9 Posts 4 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.
  • F Offline
    F Offline
    freshonlineMax
    wrote on last edited by
    #1

    Hi I want to get sql server table fields Description, I want to use them for my datagrids header text. So how can i get field description from database table? Tanks

    N R L 3 Replies Last reply
    0
    • F freshonlineMax

      Hi I want to get sql server table fields Description, I want to use them for my datagrids header text. So how can i get field description from database table? Tanks

      N Offline
      N Offline
      Nader Elshehabi
      wrote on last edited by
      #2

      freshonlineMax wrote:

      I want to get sql server table fields Description

      What makes you think there ought to be one? Take a look at DataColumn class in your documentation, you'll see it has no description member. I usually name my columns in the database in a human friendly way so that I'd name the DataGridColumns with the same string using a loop -with some modifications of course like removing underscores-.

      Regards:rose:

      R 1 Reply Last reply
      0
      • N Nader Elshehabi

        freshonlineMax wrote:

        I want to get sql server table fields Description

        What makes you think there ought to be one? Take a look at DataColumn class in your documentation, you'll see it has no description member. I usually name my columns in the database in a human friendly way so that I'd name the DataGridColumns with the same string using a loop -with some modifications of course like removing underscores-.

        Regards:rose:

        R Offline
        R Offline
        Robert Rohde
        wrote on last edited by
        #3

        Just because the DataColumn class doesn't have such a property doesn't mean there is now way to get this info... Robert

        N 1 Reply Last reply
        0
        • R Robert Rohde

          Just because the DataColumn class doesn't have such a property doesn't mean there is now way to get this info... Robert

          N Offline
          N Offline
          Nader Elshehabi
          wrote on last edited by
          #4

          Robert Rohde wrote:

          doesn't mean there is now way to get this info...

          And what other ways do you know to get that information? Also when you make a Sql table where do you put that information?

          Regards:rose:

          F 1 Reply Last reply
          0
          • N Nader Elshehabi

            Robert Rohde wrote:

            doesn't mean there is now way to get this info...

            And what other ways do you know to get that information? Also when you make a Sql table where do you put that information?

            Regards:rose:

            F Offline
            F Offline
            freshonlineMax
            wrote on last edited by
            #5

            Dear Nade Elshahabi Please don't answer your friend's questions with an another question and let others to help and show the best way. I had a code to fetch database informations, but i lose it in my harddisk. If you don't have information about a subject you don't have to answer. I know you want to help, but others me be think, my problem have been solved. Regards

            N 1 Reply Last reply
            0
            • F freshonlineMax

              Dear Nade Elshahabi Please don't answer your friend's questions with an another question and let others to help and show the best way. I had a code to fetch database informations, but i lose it in my harddisk. If you don't have information about a subject you don't have to answer. I know you want to help, but others me be think, my problem have been solved. Regards

              N Offline
              N Offline
              Nader Elshehabi
              wrote on last edited by
              #6

              freshonlineMax wrote:

              Please don't answer your friend's questions with an another question

              I wasn't asking for an answer. I was proving my point of view that there is no description for Sql columns. If Robert knew how to get it he would have posted the answer. BTW where did you put that description anyway?!!

              freshonlineMax wrote:

              I had a code to fetch database informations, but i lose it in my harddisk.

              Database information?? You mean that present in the INFORMATION_SCHEMA? Check the INFORMATION_SCHEMA.COLUMNS table and see if it has a description field!!

              freshonlineMax wrote:

              If you don't have information about a subject you don't have to answer.

              :~

              freshonlineMax wrote:

              I know you want to help, but others me be think, my problem have been solved.

              Sure! And forgive me -turely- if I blocked someone else from answering you. Your post is still there. He who has answer, let him benefit us all!! -- modified at 14:26 Saturday 28th October, 2006

              Regards:rose:

              F 1 Reply Last reply
              0
              • F freshonlineMax

                Hi I want to get sql server table fields Description, I want to use them for my datagrids header text. So how can i get field description from database table? Tanks

                R Offline
                R Offline
                Robert Rohde
                wrote on last edited by
                #7

                Hi, maybe this[^] is a good start. Robert

                1 Reply Last reply
                0
                • F freshonlineMax

                  Hi I want to get sql server table fields Description, I want to use them for my datagrids header text. So how can i get field description from database table? Tanks

                  L Offline
                  L Offline
                  lainoo
                  wrote on last edited by
                  #8

                  you can retrieve data from SQL select : select b.name,c.value from syscolumns b, sysobjects A,sysproperties c where a.name ='bed' and a.id=b.id and b.id=c.id and b.colorder=c.smallid then use this rows to modify your datagridview column tex if you can design this, i may design class for you: SetDatagridColumnTextBySqlDescribe(DatagridView dview)

                  Think ...

                  1 Reply Last reply
                  0
                  • N Nader Elshehabi

                    freshonlineMax wrote:

                    Please don't answer your friend's questions with an another question

                    I wasn't asking for an answer. I was proving my point of view that there is no description for Sql columns. If Robert knew how to get it he would have posted the answer. BTW where did you put that description anyway?!!

                    freshonlineMax wrote:

                    I had a code to fetch database informations, but i lose it in my harddisk.

                    Database information?? You mean that present in the INFORMATION_SCHEMA? Check the INFORMATION_SCHEMA.COLUMNS table and see if it has a description field!!

                    freshonlineMax wrote:

                    If you don't have information about a subject you don't have to answer.

                    :~

                    freshonlineMax wrote:

                    I know you want to help, but others me be think, my problem have been solved.

                    Sure! And forgive me -turely- if I blocked someone else from answering you. Your post is still there. He who has answer, let him benefit us all!! -- modified at 14:26 Saturday 28th October, 2006

                    Regards:rose:

                    F Offline
                    F Offline
                    freshonlineMax
                    wrote on last edited by
                    #9

                    Hello Again Dear friend 'Nader Elshehabi' I solve my problem my self!:cool: Now i can help myself, you(if agree) and others (if it's useful!) Just run below query in sqlServer:

                    SELECT     objtype, objname, name, value
                    FROM         ::fn_listextendedproperty(NULL, 'user', 'dbo', 'table', 'YourTablename', 'column', DEFAULT) AS fn_listextendedproperty_1
                    

                    If we want to get special column's description, we should type column's name instead of 'DEFAULT'. Field 'value' refers to column's description. Regards:)

                    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