Click here to Skip to main content
15,916,951 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I have two text box in c# .net windows application. I need to store the two text box values in single column of table in sql server database. Kindly help me.



1 solution

Well, you can concatenate the strings in the text boxes into a single sitrng and delimit with a proper delimiter like ; This would be something like:
string concatenated = string.Format("{0};{1}", textBox1.Text, textBox2.Text);

After that you can insert the data into the column in the database.

However, if those two text boxes represent different data, I wouldn't advice to use concatenation, but to add more columns into the table to hold all the independent data. Few reasons for this:
- searching is easier and more reliable
- changes in the data are easier and more reliable to handle
- possible indexing works better etc.
Share this answer

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

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