Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

How to pad a sql field when combining two fields.

$
0
0

I am using the following sql in a Maintenance form where add,edit,delete are used. The TermsConcact is the display member of a combobox.

   strb.Append("SELECT [TERMSCODE], [TERMSDESCRIPTION], [TERMSPERDISCOUNT], [TERMSDAYS], [TERMSCODE] + ' | '+ [TERMSDESCRIPTION] AS [TERMSCONCAT] FROM [BD_TERMS]");
            if (this.radioButton1.Checked) { strb.Append(" ORDER BY [TERMSCODE] "); }
            if (this.radioButton2.Checked) { strb.Append(" ORDER BY [TERMSDESCRIPTION] "); }
            strb.Append(";");

I would like to know if it is possible to write this line in a better way?

Could I pad the [TERMSCODE] to 3 characters when creating the [TERMSCONCACT]?

VS2012


Viewing all articles
Browse latest Browse all 2535

Trending Articles



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