Click here to Skip to main content
15,935,429 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
How do you write a C# SELECT Cast Query to combine 3 textbox values and save to the database?


height = 5
width = 7
unit = feet

Fieldname dimension = 5 x 7 feet

string sql = "SELECT CAST...?"
DamithSL 3-Jul-12 3:04am    
if You need to save the values of text boxes in database, then why you have select sql statement? you need to have insert statement.
DamithSL 3-Jul-12 3:06am    
Another question, you need to save it as string "5 x 7 feet" or just the value of multiplication like 35?

string strDimension = (5*7).ToString()+" feet";

string sql = "Insert Into tableX(dimension) values ('"+strDimension +"')
Share this answer
select CAST(height AS varchar) + 'X' + CAST(width AS varchar) + unitl
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900