Click here to Skip to main content
11,494,851 members (64,730 online)
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 6:58am
Edited 22-Nov-12 7:10am
__TR__29K
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 Dnyaneshwar@Pune 692
1 Sergey Alexandrovich Kryukov 354
2 CHill60 293
3 Sascha Lefèvre 255
4 Nakul Chaudhari 236
0 Sergey Alexandrovich Kryukov 10,297
1 OriginalGriff 8,821
2 Sascha Lefèvre 3,864
3 Maciej Los 3,412
4 Richard Deeming 2,500


Advertise | Privacy | Mobile
Web03 | 2.8.150520.1 | Last Updated 22 Nov 2012
Copyright © CodeProject, 1999-2015
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