Results 1 to 5 of 5

Thread: get somthing like alias from a sql database column

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2012
    Posts
    72

    get somthing like alias from a sql database column

    hi
    i have a datagridview in my form that get data from a sql database through a datatable .
    in database tables has a name that it use as datatable's column headerName.but i want to named column headerNames by a different name like alias of each column of sql table .
    but i dont know how can get an alias name or a description of each database column ( as alias ) from database . please help me about it .

  2. #2
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: get somthing like alias from a sql database column

    Well you obviously can't get it from the database because it isn't recorded in the database. You can disable automatic column addition for the DGV and set it up in advance of populating the table with your own columns and the required headers by manually setting the display members accordingly.
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Aug 2012
    Posts
    72

    Re: get somthing like alias from a sql database column

    i define a description for each column of sql table . (this description is my headerText) . but i dont know how can i get this description in my application through datatable . is there any way to do this ?
    if this problem is solved my problem is solved .pls

  4. #4
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,969

    Re: get somthing like alias from a sql database column

    I may be missing the point but you mean something like:

    select getdate() 'current date'


    and the column name would be 'Current date'

  5. #5
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,104

    Re: get somthing like alias from a sql database column

    Normally, you would do something like this in the SELECT statement, as you can provide an alias there. Is that not an option in this case?
    My usual boring signature: Nothing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width