如何分割字符串.

编程入门 行业动态 更新时间:2024-10-24 13:30:29
本文介绍了如何分割字符串.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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 ????

推荐答案

尝试使用 String.Split方法 [ ^ ]. 如果任一文本框中的文本都带有-"字符,则此方法将给您不正确的结果.因此,最好将两个文本框的值存储在数据库的单独列中. 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.

拆分字符串 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]);

更多推荐

如何分割字符串.

本文发布于:2023-11-29 00:31:35,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1644577.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字符串

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!