Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27349

using String.replace in a data table expression

$
0
0
I am working with a data table whose column naming convention uses an underscore to join common words. For example New_Column, My_Column, etc. It's a table created by another app with columns that can be added by the user. If the user enters a field name with spaces, they are replaced with the "_" and the column is added.

I am building a query engine for that table and retrieve all of the data columns using this sql.

Code:

 
SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS`
WHERE `TABLE_SCHEMA`=myDBName AND `TABLE_NAME`= myTableName

After I get the table I would like to bind it to a combo box with the value member being the column name and the display member being a new column whose row values would have any underscore replaced with a space (i.e. columnName.Replace("_ "," ")).

I have looked into the available expressions for data columns, but don't see how to make a replace happen, but maybe I missed it. If a can't do this using an expression, is there a way to tweak the sql statement to do a string.replace? I can certainly loop through the table, and do it manually but only do so if there is no other option.
thanks for your time
kevin

Viewing all articles
Browse latest Browse all 27349

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>