如何将数据库中的两个int字段在datagrid中的一列显示出来?

mhlxhm 2003-08-30 09:11:31
如何将数据库中的两个int字段在datagrid中的一列显示出来?
...全文
39 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
alphawin 2003-09-01
  • 打赏
  • 举报
回复
在select 语句中设定:
select ltrim(str(a1))+ltrim(str(a2)) as Total from temp
cnhgj 2003-08-30
  • 打赏
  • 举报
回复
用sql语句
select a+b as c from d
batisituta 2003-08-30
  • 打赏
  • 举报
回复
用SQL语句实现:
select convert(varchar(10),a1)+ ',' + convert(varhcar(10),a2) as aa from table
saucer 2003-08-30
  • 打赏
  • 举报
回复
how are you displaying?

using BoundColumn? add a new column to your data table and bound it to the new column:

DataTable1.Columns.Add("NewColumn", typeof(string), "Convert(col1,'System.String') + ';' + Convert(col2,'System.String')");

otherwise, do
<%# DataBinder.Eval(Container.DataItem,"col1")%>:<%# DataBinder.Eval(Container.DataItem,"col2")%>

or

<%# DataBinder.Eval(Container.DataItem,"col1").ToString() + ":" + DataBinder.Eval(Container.DataItem,"col2").ToString()%>
jiezhi 2003-08-30
  • 打赏
  • 举报
回复
如何顯示在一起?
123 456 ?
最簡單的辦法就是使用sql語句了。
rouser 2003-08-30
  • 打赏
  • 举报
回复
AS 成一個字段
雪狼1234567 2003-08-30
  • 打赏
  • 举报
回复
在select 语句中设定:
select ltrim(str(a1))+ltrim(str(a2)) as Total from temp

110,536

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

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