DataGrid的问题

ballnan 2005-04-19 07:04:11

id name
1 b
1 c
我要把表里字段name里的内容显示在DataGrid里面的同一记录的同一列里面
也就是说b和c放在DataGrid的同一格里面
请问怎样实现?说具体点谢谢
...全文
235 12 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
nga96 2005-04-21
  • 打赏
  • 举报
回复
sql
ballnan 2005-04-20
  • 打赏
  • 举报
回复
用存储过程??怎么写啊???
各位大哥详细点吧!!!!
ballnan 2005-04-20
  • 打赏
  • 举报
回复
用SQL语句怎样写啊???说具体点行吗
haonanernet 2005-04-20
  • 打赏
  • 举报
回复
看看这个列子吧,能够通过datagrid直接调入数据了
这也是SQL版块  xluzhong(Ralph)的回答,我测试了下,完全正确
zjcxc好象不行


-------------参考例子
--建立测试环境
create table tb2 (id int,type nvarchar(10))
insert into tb2 select 1,'a'
insert into tb2 select 1,'b'
insert into tb2 select 1,'c'
insert into tb2 select 1,'d'
insert into tb2 select 2,'a'
insert into tb2 select 3,'b'
insert into tb2 select 4,'c'
insert into tb2 select 4,'d'
go
--查询处理
create function f_catString(@id int)
returns nvarchar(1000)
as
begin
declare @s nvarchar(1000)
set @s=''
select @s=@s+','+type from tb2 where id=@id
return(stuff(@s,1,1,''))
end
go
--调用函数
select id,dbo.f_catString(id) as type from tb2 group by id
go

--删除测试环境
Drop Table tb2
hamadou 2005-04-20
  • 打赏
  • 举报
回复
好象直接用sql语句写不容易,用存储过程写就是了。很简单的!
zhendeqiufeng 2005-04-20
  • 打赏
  • 举报
回复
select id + name from 表
hamadou 2005-04-20
  • 打赏
  • 举报
回复
CREATE PROCEDURE union_name
AS
declare @s varchar,@id as int,@name varchar ,@temp varchar,@t_id int
set @temp=""
set @t_id=0
create table #temp(id int not null primary key,name varchar(20) not null )
declare my_cusor cursor for select id,name from u_name order by id
open my_cusor
fetch next from my_cusor
into @id, @name
while @@FETCH_STATUS = 0
begin
if @id <>@t_id
begin
insert into #temp(id,name) values(@id,@name)
set @t_id = @id
end
else
begin
update #temp set name = name + @name where id=@t_id
end
fetch next from my_cusor
into @id, @name
end
close my_cusor
deallocate my_cusor
select * from #temp
GO
gyf19 2005-04-19
  • 打赏
  • 举报
回复
这种表现用DataGrid本身是没法实现的了。
解决办法:
1。把你要帮定的DataTable重新处理为你想要的样子,具体办法就是遍列啦
或者
2。直接用SQL语句得到你想要的数据
jcdwin3 2005-04-19
  • 打赏
  • 举报
回复
转sql版吧,估计用子查询
chenczx1 2005-04-19
  • 打赏
  • 举报
回复
帮你UP
LoveCherry 2005-04-19
  • 打赏
  • 举报
回复
http://www.cnblogs.com/zhongru_tu/archive/2005/01/27/98302.html
v192 2005-04-19
  • 打赏
  • 举报
回复
这种表现用DataGrid本身是没法实现的了。解决办法,把你要帮定的DataTable重新处理为你想要的样子,具体办法就是遍列啦
jQuery EasyUI是一组基于jQuery的UI插件集合,而jQuery EasyUI的目标就是帮助web开发者更轻松的打造出功能丰富并且美观的UI界面。开发者不需要编写复杂的javascript,也不需要对css样式有深入的了解,开发者需要了解的只有一些简单的html标签 1.3.6更新 Bug treegrid: getChecked方法不能返回正确的行. fixed. tree: 异步树,在onlyLeafCheck:true时复选框不显示正确. fixed. Improvement treegrid:继承datagrid组件所有的selecting和checking方法。 linkbutton:图标对齐方式,支持值:'top','bottom','left','right'。 linkbutton:添加"size"属性,支持值:'small','large'。 linkbutton:添加的onClick事件。 menubutton:添加"menuAlign"属性,允许用户设置顶级菜单对齐。 combo:添加"panelAlign"属性,支持值:'left','right'。 calendar:"formatter"、"styler"和"validator"选项可用于自定义日历日期。 calendar:添加的onChange事件。 panel:添加"method","queryParams"和"loader"属性。 panel:添加"onLoadError"事件。 datagrid:添加"onBeginEdit"事件。 datagrid:添加"onEndEdit"事件。 datagrid:添加"sort"方法和"onBeforeSortColumn"事件。 datagrid:"combogrid"编辑器集成到datagriddatagrid:添加"ctrlSelect"属性,允许使用ctrl+click 多选 slider:添加"converter"选项,允许用户决定如何将一个值转换为滑块的位置或滑块位置值。 searchbox:添加"disabled"属性。 searchbox:添加"disabled","enable","clear","reset"方法。 spinner:添加"readonly"属性、"readonly"方法和"onChange事件。

16,721

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧