Jump to content


Photo

Including SQL column names?


  • Please log in to reply
2 replies to this topic

#1 littlebigfred

littlebigfred
  • Members
  • 176 posts

Posted 20 July 2009 - 10:23 AM

Hello

I'd like to have the grid contain both user-friendly column names (eg. "Identification") and their SQL equivalents (eg. "id"). This grid is a two-column key=value grid:

http://img149.images...udesqlcolum.jpg

I thought about putting the SQL names in the very first column and hide it so that users will only see the user-friendly names + values (ie. the first row would contain ["id","Identification", "123"], but I'd like to check with you if there's a better way.

Thank you.

#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,196 posts
  • Gender:Male

Posted 20 July 2009 - 04:48 PM

Hello Fred,

Do you think about storing them into first row (not column)?

I think that this approach is fine. You may also set MultiLine property of Column.Header to True. Then put multi-lined caption inside Header.Caption property (e.g. 'Line1' + #13#10 + 'Line2' )

I hope that this helps.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#3 littlebigfred

littlebigfred
  • Members
  • 176 posts

Posted 08 September 2009 - 11:03 AM

Thanks Boki for the tip. I forgot to reply, but since then, I found a much better solution to have a column host both information (SQL column name + user-friendly caption):

CODE
Columns.Add(TNxTextColumn,'Key');
Columns[0].Name := 'key';


That way, we can display a nice caption in the grid, and still be able to grab its corresponding SQL column name when building an SQL query.

HTH,




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users