如何拆分字符串以及如何将拆分值分配给文本框? [英] How to split string and how to assign split values to textboxs?

查看:86
本文介绍了如何拆分字符串以及如何将拆分值分配给文本框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友我正在为一个Web应用程序工作..我从数据库中获取数据我需要拆分数据并分配给不同的文本框...

解决方案

< blockquote>我建​​议从基础开始:

如何:拆分字符串(C#编程指南) [ ^ ]


根据您编写的问题,听起来您将多个数据项存储在一个列中。这会导致您获取数据时需要拆分数据以便正确显示或操作的情况。



所以这一切都回归到设计中。对于多个数据项使用单个列是您很可能会后悔的选择。它引入了不必要的复杂性,例如:



  • 如何在提取时分割数据
  • 如何连接数据
  • 如何部分查询数据等等...


因此,如果数据项的数量是固定的,而不是使用单个列众所周知,你可以使用多个列。如果项目数量未知或您需要向其添加描述性信息,请对具有此父表的外键的数据使用单独的表。


friends i am working for a web application..in that i get the data from database i need to split the data and assign to different textboxes...

解决方案

I'd suggest to start with basics:
How to: Split Strings (C# Programming Guide)[^]


Just based on the question you have wrote, it sounds like you store multiple data items inside a single column. This causes a situation that when you fetch the data you need to split the data in order to be correctly shown or manipulated.

So it all comes back to design. Using a single column for multiple data items is a choice you will most likely regret later. It introduces unnecessary complexity, like:

  • how to split the data when fetched
  • how to concatenate data
  • how to query the data partially and so on...

So instead of using a single column, if the amount of data items is fixed and they are known, you can use multiple columns. If the amount of items is unknown or you need to add descriptive information to them, use a separate table for the data having a foreign key to this, parent table.


这篇关于如何拆分字符串以及如何将拆分值分配给文本框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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