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