[C #] how to display the query result of the datagridview as an alias (non-database column name)

Source: Internet
Author: User

 

There are two methods: (1) the SQL statement to be queriedCodeTime: String SQL = "select username as name, usernum as number, userclass as department from userinfo"; (Chinese is displayed ). (2) interface operation: drag and drop the dview control in the form, and you will see a small triangle in the upper right corner of the datagridview control. Click the small triangle to see the "datagridview task ", select "Edit column". In the pop-up "Edit column window", click "add" to add several columns, select a column from "selected columns" on the left, and then select (input): Data: datapropertyname (column name in the table) in "unbound column attributes" on the right. Appearance: headertext (Chinese name to be displayed ).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.