2

How can I split or put into another row the words in a textbox when being inserted into MS Access(Database). For example, my textbox has these words: ABC DEF GHI JKL

And when the user press the enter button, the following words will be inserted into the textbox, but each words will be in a new row? Like, ABC will be in the first row, DEF will be in the second and so on. Please help me. Thanks.

chenpai
  • 25
  • 3
  • 1
    Look into [`String.Split`](http://msdn.microsoft.com/en-us/library/system.string.split(v=vs.110).aspx) – jerry Feb 15 '14 at 04:00

1 Answers1

0

for split a text you should do this:

string test = "ABC DEF GHI JKL";
string[] splitedText = test.Split(' ');

For insert in access use this:

OleDbCommand CmdSql = new OleDbCommand("Insert into [product] (Kod, [names],price,type," + 
                                       "volume,manufacturer,importer) " +
                                       "VALUES (?, ?, ?, ?, ?, ?, ?)";
Community
  • 1
  • 1
  • @SudhakarTillapudi huh? i didn't down vote your answer. I just marked a check for this one since he's the first one to post an answer. :/ It's the others. – chenpai Feb 15 '14 at 04:36
  • @SudhakarTillapudi can you prove that I voted you down? –  Feb 15 '14 at 04:44
  • @SudhakarTillapudi I down voter.i dont love your answer.and i think your answer is wrong – Mohammad Feb 15 '14 at 04:48
  • @ShahroozJefriㇱ: yes i can prove that , if i delete my answer you will get DownVote Rep +1. – Sudhakar Tillapudi Feb 16 '14 at 10:19
  • @SudhakarTillapudi please answer for help and not for reputation –  Feb 16 '14 at 10:30
  • @ShahroozJefriㇱ: you caught even before its second time , now don't say wise words to escape. if it repeats once again i directly raise flag to moderator. if you can explain what is wrong guide me i accept and correct my mistakes but dont simply downvote people to put down. – Sudhakar Tillapudi Feb 16 '14 at 10:32
  • @ShahroozJefriㇱ: dear you have repeated it again with your dummy Account -> http://stackoverflow.com/users/336204/mohammad?tab=reputation downvoted my answer here ->http://stackoverflow.com/questions/21811339/why-duplicate-and-more-semicolon-at-end-of-expression-not-cause-error-in-visual/21811352#21811352 if you don't retract your downvotes im going to raise a flag about all your fake accounts. – Sudhakar Tillapudi Feb 16 '14 at 13:44