拖入数据网格视图时如何替换数据库的字段名称 [英] how to replace field name of database when dragging in to data grid view

查看:68
本文介绍了拖入数据网格视图时如何替换数据库的字段名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用c#.Net和Sql Server制作桌面应用程序.

我已使用datagrid视图来显示存储在SQL中的数据.

我正在显示数据.现在我希望数据库中的字段名称在数据网格视图中应替换为另一个名称.
(例如,如果我在数据库中具有字段名称Product_Id,则在数据网格视图中,该字段名称应类似于产品ID)
问候

I am making desktop application using c#.Net and Sql Server.

I have taken datagrid view to display the data which is stored in SQL.

I am getting the data displayed.Now i want that the fiels name which are in database should get replaced with another name in data grid view.
(e.g if i am having field name Product_Id in database then in dat grid view it should be like Product ID)
regards

推荐答案

在SQL中为其使用别名,您可以为特定的列指定别名
use alias name for it in SQL you can give alias name to a particular column
select Product_id as ''Product Id'' from table


要了解有关别名的更多信息,请参考以下链接单击此处


to know more about alias refer to the following link Click Here


这篇关于拖入数据网格视图时如何替换数据库的字段名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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