简体   繁体   中英

Winforms Datagrid, display foreign key

Currently I have a DataGrid, and a datasource.

The Datasource is directly pulled from the database in this order:

Id, SalaryId, Old, New

Problem is that it displays the SalaryId, I want it to display the SalaryId Value

How do I do this?

Pure guess here, but you probably just need to rewrite your original SQL query from something like:

SELECT ID, SALARYID, OLD, NEW FROM tblEMPLOYEE

to something like:

SELECT a.ID, b.SALARYVALUE, a.OLD, a.NEW FROM tblEMPLOYEE a, tblSALARY b
WHERE a.SALARYID = b.ID

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM