在Windows应用程序中拆分列 [英] split columns in windows application

查看:79
本文介绍了在Windows应用程序中拆分列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个产品表,共有32个产品,我想将这16个产品绑定到column1中,将剩余的16个绑定到另一个column2中,例如

column1 column2
1 17
2 18
3.
.
..
16 32


如何在Windows窗体应用程序中将其绑定.

解决方案

不确定我是否正确理解了这个问题,但是当您获取数据时,可以将其排序为两列.例如,如果您有一个标识产品的数字并且该数字是从1到32,则您的查询可能类似于

 选择 p1.Name,p2.name
来自产品p1,
      产品p2
其中 p1.id +  16  = p2.id
 p1.id< =  16  


而且,如果表中没有此编号,则可以使用 ROW_NUMBER [ ^ ]生成它.所以像

 选择 p1.Name,p2.name
来自(选择 p.Name,ROW_NUMBER()> ( ORDER   BY  p.Name) from 产品)作为 p1,
      (选择页名称,ROW_NUMBER() OVER (> ORDER   BY  p.Name)来自产品) p2
其中 p1.id +  16  = p2.id
 p1.id< =  16  


I have a products table in this total 32 products are there i want bind this 16 products into column1 and remaining 16 into another column2 like

column1 column2
1 17
2 18
3 .
.
..
16 32


How to bind this in windows forms applications .

解决方案

Not sure if I understood the question correctly, but when you fetch the data you could sort the to two columns. For example if you have a number identifying the product and the number is from 1 to 32, your query could look something like

select p1.Name, p2.name
from  product p1,
      product p2
where p1.id + 16 = p2.id
and   p1.id <= 16


And if you don''t have such number in the table, you can use ROW_NUMBER[^] to generate it. So something like

select p1.Name, p2.name
from  (select p.Name, ROW_NUMBER() OVER (ORDER BY p.Name) from product) as p1,
      (select p.Name, ROW_NUMBER() OVER (ORDER BY p.Name) from product) as p2
where p1.id + 16 = p2.id
and   p1.id <= 16


这篇关于在Windows应用程序中拆分列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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