Click here to Skip to main content
15,886,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
cmd.Parameters.AddWithValue("@Account_No", txtaccount1.Text + "-" + txtaccount2.Text);

Here I am inserting data in a column from different text boxes, how to retrieve same data from database in different text boxes ????
Posted
Updated 22-Nov-12 6:10am
v2

Split String
C#
string str;
str = "Ali-Asadi-...";
     string[] master;
       master = str.Split((char)45);//45 Key ASCII -
         MessageBox.Show(master[0]);
         MessageBox.Show(master[1]);
       //MessageBox.Show(master[i]);
 
Share this answer
 
Try using String.Split Method[^].
This method will give you incorrect results if the text in either of the text-boxes have a "-" character. So its better to store the values of both the textbox in separate columns in the database.
 
Share this answer
 
Comments
Sk. Tajbir 22-Nov-12 12:22pm    
nice link.. 5+

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