Click here to check my latest exciting videos on youtube
Search Mallstuffs

Flag Counter
Spirituality, Knowledge and Entertainment


Locations of visitors to this page


Latest Articles


Move to top
Binding Database columns with apostrophe
Posted By Sarin on Nov 26, 2012     RSS Feeds     Latest Hinduism news
3219 Views


In one of my project, I faced a situation of binding a database column to datagrid with apostrophe in its name.In such cases, the normal way of binding columns does not work.  
Normally we bind the database column to the grid as

Text='<% # Bind("[Salary]") %> '
Where Salary is the database column name.
  
Now suppose if I have a column name with apostrophe like Salary’s in the above case then binding the columns as  
Text='<% # Bind("[Salary’s]") %> ' will not work. It willl throw an compile time error as shown below
  

  
To solve this issue, simply bind the columns as  
Text="<% # Bind('[Salary's]') %> "
  
Having an apostrophe or any other special characters in the database column name is not a good naming convention. But in some primitive application, you might interact with such column names. Hope this article and attached sample code helps you in such scenario.


Note: Images used on this website are either a production of Bhaktivedanta Book Trust(https://www.krishna.com), Iskcon Foundation or were found in google search under "Free to use and share". If any of the images presented here violates copyright issues or infringes anyone copyright or are not under "Fair use", then please bring it to our notice. Read Disclaimer for more.

Share this to your friends. One of your friend is waiting for your share.
Share on Google+ Share on Tumblr Print Browser Favorite
Related Articles
Calling web service asynchronously using jquery ajax
Need and advantages of using computed columns
Binding Database columns with apostrophe
Create property class of database table
Database cannot be opened due to inaccessible files or insufficient memory or disk space
How to sort an ObservableCollection
Visitors-Hits counter for your website
Change structures-constraints of table using alter command
Apply Multiple Order by on a list using LINQ

Post Comment