Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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 22-Nov-12 5:58am
Edited 22-Nov-12 6:10am
__TR__28.9K
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
Comments
Sk. Tajbir at 22-Nov-12 12:22pm
   
nice link.. 5+
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Split String
    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]);

  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 878
1 OriginalGriff 410
2 CPallini 275
3 George Jonsson 226
4 Richard Deeming 145
0 OriginalGriff 5,450
1 CPallini 4,500
2 Sergey Alexandrovich Kryukov 4,482
3 George Jonsson 3,057
4 Gihan Liyanage 2,445


Advertise | Privacy | Mobile
Web04 | 2.8.140916.1 | Last Updated 22 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100