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. Alias for table names

Alias for table names

Scheduled Pinned Locked Moved Database
database
3 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.
  • S Offline
    S Offline
    smita_roy
    wrote on last edited by
    #1

    I have a list box which shows the tables in the database.I don't want to show the real table name instead an alias for those tables names should go how this can be done

    N S 2 Replies Last reply
    0
    • S smita_roy

      I have a list box which shows the tables in the database.I don't want to show the real table name instead an alias for those tables names should go how this can be done

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      Just don't show the names. Replace the displayed text with whatever you want the user to see. You can use the tag property to store the actual name or maintain an array indexed by the listbox index.

      1 Reply Last reply
      0
      • S smita_roy

        I have a list box which shows the tables in the database.I don't want to show the real table name instead an alias for those tables names should go how this can be done

        S Offline
        S Offline
        softty
        wrote on last edited by
        #3

        Create one DataView from Data Source or Manually replace those table name with your logic... I have created a fake table, in real situation , query from database /// Create DataSource :: select tablename,tablealias from all_tables /*Code::*/ ICollection CreateDataSource() { DataTable dt = new DataTable(); DataRow dr; dt.Columns.Add(new DataColumn("TableName", typeof(string))); dt.Columns.Add(new DataColumn("TableAlias", typeof(string))); for (int i = 0; i < 9; i++) { dr = dt.NewRow(); dr[0] = i.ToString() + " No Table"; dr[1] = i.ToString() + " No Alias"; dt.Rows.Add(dr); } DataView dv = new DataView(dt); return dv; } // Fill the list with above mentioned datasource private void FillList() { ListBox1.DataSource = CreateDataSource(); ListBox1..DataTextField="TableName"; ListBox1.DataValueField="TableAlias"; } happy programming.. Pijush Biswas, Jaisalmer softestpk@yahoo.com love2code

        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