如何从multilpe文本框中的单列中获取数据? [英] how to fetch data from single column in multilpe text boxes ?

查看:61
本文介绍了如何从multilpe文本框中的单列中获取数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

cmd.Parameters.AddWithValue("@ CNIC",txtcnic1.Text +-" + txtcnic2.Text +-" + txtcnic3.Text);

cmd.Parameters.AddWithValue("@CNIC", txtcnic1.Text + "-" + txtcnic2.Text + "-" + txtcnic3.Text);

推荐答案

如何从多文本框中的单列中获取数据
您的问题标题是指检索单列值,而代码看起来就像是将多个值插入到单列中.根据标题,您需要从可能用逗号分隔的列中检索值.然后使用Split方法并获取可以根据需要分配的单独值.

Split返回一个字符串数组,其中包含主字符串的子字符串,这些子字符串由指定的Unicode字符数组的元素分隔.参数指定是否返回空数组元素.
参考: MSDN:拆分 [ C#拆分 [ ^ ]
how to fetch data from single column in multilpe text boxes
Your question title speaks of retrieving single column value whereas code looks like inserting multiple values into a single column. Based on title, you need to retrieve the value from a column which probably will be comma separated. Then use Split method and get separate values that can be assigned as per need.

Split returns a string array that contains the substrings of the main string that are delimited by elements of a specified Unicode character array. A parameter specifies whether to return empty array elements.
Refer: MSDN: Split[^]

Sample: C# Split[^]


这篇关于如何从multilpe文本框中的单列中获取数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆