在数据库中输入时文本拆分文本 [英] splitting texts in textbox when entering in database
本文介绍了在数据库中输入时文本拆分文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我怎么能在一个文本框拆分或放入另一行字插入的MS Access(数据库)时。
为例,我的文本框有这样的话:
ABC
DEF
GHI
JKL
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
和时用户按下回车键,下面的话会被插入到文本框,但每个字将在一个新行?等,美国广播公司将在第一行中,DEF将在第二等。请帮帮我。谢谢
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.
推荐答案
有关拆分你应该做这样的文本:
for split a text you should do this:
string test = "ABC DEF GHI JKL";
string[] splitedText = test.Split(' ');
有关在Access中使用的这个:
For insert in access use this:
OleDbCommand CmdSql = new OleDbCommand("Insert into [product] (Kod, [names],price,type," +
"volume,manufacturer,importer) " +
"VALUES (?, ?, ?, ?, ?, ?, ?)";
这篇关于在数据库中输入时文本拆分文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文